Camera Rotation is stuck because of PointerInput.FakeMove

Hello BJS community!
I’m on the latest commit in master branch, though the problem appears to be there for a few months I believe.
The steps:

  • Open any Playground with rotation camera. e.g. this one.
  • Press and hold left mouse button
  • Without releasing left mouse button press right mouse button
  • Release left mouse button
  • Release right mouse button

Bug! :bug: Now you can rotate the camera without pressing mouse buttons.
This happens because in scene.inputManager eventData.inputIndex is considered to be PointerInput.FakeMove which is triggered when two mouse buttons are pressed.
I’m talking about this line specifically

@Eugene_R, this is an awesome repro and I ll send it over @PolygonalSun to have a loook tomorrow, thanks a ton for the detailed repro !!!

Great find! I’m gonna take a look at this today and figure out what’s going on.

3 Likes

Fix is in PR: DeviceInputSystem: Fix FakeMove by PolygonalSun · Pull Request #10645 · BabylonJS/Babylon.js (github.com)

3 Likes

Fix has been merged

I’ve decided to test it on the fresh alpha.33 and the camera doesn’t get stuck though the buttons still seem to not behave exactly as intended. E.g. in arc rotate camera PG you can

  • press left mouse button
  • without releasing press right mouse button
  • release left mouse button
    You can rotate with right mouse button. Could you confirm that still seems like a bug?

The same goes for panning. RMB first and then LMB.

1 Like

Sounds like by design to me :slight_smile: I wonder which makes more sense ? @PatrickRyan Basically, as long as you are pressed you continue the current behavior.

@sebavan, I don’t think this is the best behavior. I agree with the idea that if you press left button first, adding right button down would not cancel the rotation of the camera while left button is still down. However, releasing the left button should cancel the rotation of the camera and then the question is what happens with the right button down input.

We have two options:

  • Any subsequent mouse input after the first is ignored while the first action is still live. For example, if you press left mouse, camera rotates. Then if you add right mouse, camera still rotates. When you release left button, nothing happens as the right button down was called when in an ignore state. So to pan you would need to release the right button and press again.
  • Any subsequent mouse input after the first is added to the stack. Left mouse press rotates camera, then right button pressed adds the pan action to the stack waiting for rotate to end. Once rotate ends with the left button up, we check to see if right button is still down and if so immediately start panning.

I could see either of those behaviors not being too disruptive to the experience. With the first the user would probably realize quickly that they can’t press both buttons at once, which seems reasonable. With the second, the user won’t really notice anything as the experience will seems very responsive since it knows the order in which the user sends input to the system. The second seems like a more complex solution however, but I will leave that up to you to decide which is the more sustainable route with fewer edge cases.

Yup let s stick with option 1 and see when @PolygonalSun is back to introduce the fix.

2 Likes