Jump to content

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: https://www.babylonjs-playground.com/#0ZQ985#9

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.
Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...