Sign in to follow this  

The Babylon.js and the touchstart/move/end events problems

Recommended Posts

I am not good at english, very sorry about that.

Use the pc chrome emulated any touch devices open:

Runtime Environment:

  • Highly customized environment of the phone app.
  • Only touchstart/move/end events.
  • No PointerEvent object.


So, I did:

  • Create the custom PointerEvent object.
  • Create and use the ArcRotateCameraTouchInput object(use the scene.simulatePointerDown/Move/Up methods).
  • Let the _onPointerDown/_onPointerMove/_onPointerUp of the Babylon.Scene properties listen to the canvas touchstart/move/end events.

Already successful:

  • Rotate the camera
  • Interact with OnPickUpTrigger of the blue sphere.
  • Interact with mesh ui button. 


  • Touch any position alway trigger the full screen ui button event.
  • The Panning/Pinch control of the camera.
  • Cannot trigger the OnPickTrigger event of the red sphere.

Share this post

Link to post
Share on other sites
14 hours ago, Deltakosh said:

Hello, can you remind me why you need that?

Why not using jQuery PEP suffice?

Because the runtime env is not a normal html env, that is more like run at the Node.Js.

The runtime env just exposed the "game.js" file entry and GameGlobal/wx/canvas three global objects to the developer, no window/document objects, no Html DOM system.

And it bind a touch events like that(need to fake a event system to trigger the canvas listened events):


I think the touch event cycle is : When touch, the Android/iOS native app will trigger the wx object touch series events.

My friend make a module  to fake the window/document objects and Babylon.js runs successfully (just has simulate the touchstart/touchmove/touchend events, no simulate the pointer series events)

I tried the jQuery pep not work, I think the jQuery pep module just can work on the normal html env.

So I want to keep to use the touch events, and just solved the three problems then It's perfect.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.