Arcrotatecamera multitouch second finger down causes instant rotation

EDIT (happy news):

  • get this, is awesome, so the whole bug report below is totally accurate, except that I was using preview.babylonjs.org/library
  • I can confirm that in the “preview” CDN, this bug is apparent. The multitouch is broken for the arcRotateCamera
  • HOWEVER, I can report that in cdn.babylonjs.org/library… the multitouch pinch zoom is working perfectly. :slight_smile:

Bug Report

I have been looking at the source code here: Babylon.js/arcRotateCameraPointersInput.ts at master · BabylonJS/Babylon.js · GitHub
It seems that when the second finger touch comes down in order to begin a pinch, the onTouch method is causing a rotation of the camera alpha/beta before the multitouch pinch is registered and takes over control of the camera.

Firstly this appears to me to be a bug in the implementation, but perhaps I am missing something.

Secondly, I would like to check, because if its not a bug, and I need to make my own inputController for the camera, then I am thinking this:

Can I use the onButtonDown method to findout if the current buttonDown is part of a multitouch behaviour?

I am pretty sure that this worked perfectly up until recently.

I have tried using the browser css touch-action: pinch-zoom to try and intercept this such that a second touch event doesnt reach the canvas, however this does not appear to do anything.

I mean there are two refactors of arcRotateCameraPointersInput which relate to the number of buttons being pushed, here: Port ArcRotateCameraPointersInput to use BaseCameraPointersInput. · BabylonJS/Babylon.js@410a9af · GitHub, and here: Refactor so buttonCount is not passed in onButtonDown/Up. · BabylonJS/Babylon.js@90ae842 · GitHub

This behaviour used to work fine.

Im going to change category to bug

Ive looked at the implementation of BaseCameraPointersInput, and it looks like its not calling onTouch… or rather it looks like the code is designed to not call onTouch on the second finger touch.

Im not really set up to debug and test the libraries in my development environment.

If the answer to the question is not clear, then I will set up to debug the library myself. Currently Im just pulling from CDN

1 Like

Tagging our input wizard @PolygonalSun

For multi-touch, I don’t believe that this will provide any explicit multi-touch information as the event is a PointerEvent. You technically could get a pointerId and track when multiple ids are down.

As far as the bug itself, lemme dig in a bit because I think that I have an idea what’s going on. If it’s what I think it is, it shouldn’t be too difficult to fix.

Just wanted to post an update. I’m still digging into this but my findings so far were that while the second touch is being registered and used in onMultiTouch, it looks like one of the touches is being lost before actual multi-touch movement. I’m still working on a fix but I just wanted to reply that this is being actively worked on.

1 Like

amazing. i love open source. I’m using Babylon js to build survey software for the National Health Service in the UK.

we’ve gone through the first prototype phase, and started internal usage for one nhs group (there are hundreds) this week.

the survey tool is to help patients and other users of that nhs communicate if they are being listened to, and to help ensure patient driven iterative improvement in the whole health service.

cool :slight_smile:

thank you so much for your help

3 Likes

Fix is in PR: DeviceInputSystem: Adjust order of operations on pointerdown by PolygonalSun · Pull Request #11812 · BabylonJS/Babylon.js (github.com)

1 Like

Fix is merged

1 Like