Mobile gesture best practice

Hi there,
i’ve build my own panning with right click on desktop and i would like to make it working also on mobiles.
On desktop device i use BABYLON.PointerEventTypes.POINTERMOVE event and then i work with pointerInfo.event.movementX and pointerInfo.event.movementY to get mouse movements.
On mobile these properties seems to produce no result.
Only pointerInfo.event.clientX or pointerInfo.event.clientY return the screen position of the finger on the device.

How can i get fingers movement like mouse does?
And, another question, is it possible to handle two fingers gestures?
Thank you

you should have a look into the built in inputs in the source code : Babylon.js/arcRotateCameraPointersInput.ts at master · BabylonJS/Babylon.js · GitHub

1 Like

Thank you,
so, if i understand rigth i’ve to add the ArcRotateCameraPointersInput and then try to handle the onMultiTouch event. I tryied something similar on this PG https://playground.babylonjs.com/#A6TFXB#32 but i think i miss something. How can i get panning information? It seems i can get only pointA e pointB.

 protected onMultiTouch(pointA: Nullable<PointerTouch>,
 pointB: Nullable<PointerTouch>,
 previousPinchSquaredDistance: number,
 pinchSquaredDistance: number,
 previousMultiTouchPanPosition: Nullable<PointerTouch>,
 multiTouchPanPosition: Nullable<PointerTouch>): void
....

Can i suggest for the next docs release to include also this informations? I think could be very useful.

I am suggesting that you use the source code as an helper to create your own kind of inputs as most of the part related to multi touch panning is in already.