# Camera Rotation is stuck because of PointerInput.FakeMove

**URL:** <https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171>\
**Category:** Bugs\
**Tags:** input, camera\
**Created:** [July 5, 2021, 3:46pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171 "2021-07-05T15:46:37Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_R](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/eugene_r/32/17211_2.png) [@Eugene\_R](https://forum.babylonjs.com/u/Eugene_R)\
**Post date:** [July 5, 2021, 3:46pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/1 "2021-07-05T15:46:37Z")

</div>

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](https://playground.babylonjs.com/#KHQBRL).
- Press and hold left mouse button
- Without releasing left mouse button press right mouse button
- Release left mouse button
- Release right mouse button

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](https://github.com/BabylonJS/Babylon.js/blob/master/src/Inputs/scene.inputManager.ts#L885) specifically

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 5, 2021, 7:06pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/2 "2021-07-05T19:06:01Z")

</div>

@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 !!!

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [July 6, 2021, 6:44pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/3 "2021-07-06T18:44:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 6, 2021, 7:36pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/4 "2021-07-06T19:36:54Z")

</div>

Assigned @PolygonalSun on July 6, 2021, 7:36pm UTC



---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [July 7, 2021, 9:56pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/5 "2021-07-07T21:56:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [July 8, 2021, 7:03pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/6 "2021-07-08T19:03:27Z")

</div>

Fix has been merged

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [July 8, 2021, 7:32pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/7 "2021-07-08T19:32:30Z")

</div>

Unassigned @PolygonalSun on July 8, 2021, 7:32pm UTC



---

<div class="post-metadata">

**Author:** ![Eugene\_R](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/eugene_r/32/17211_2.png) [@Eugene\_R](https://forum.babylonjs.com/u/Eugene_R)\
**Post date:** [July 22, 2021, 3:02pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/8 "2021-07-22T15:02:30Z")

</div>

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](https://www.babylonjs-playground.com/#12WBC#69) 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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 22, 2021, 3:33pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/9 "2021-07-22T15:33:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PatrickRyan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/patrickryan/32/3417_2.png) [@PatrickRyan](https://forum.babylonjs.com/u/PatrickRyan)\
**Post date:** [July 22, 2021, 3:55pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/10 "2021-07-22T15:55:43Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 22, 2021, 4:07pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/11 "2021-07-22T16:07:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 22, 2021, 4:07pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/12 "2021-07-22T16:07:40Z")

</div>

Assigned @PolygonalSun on July 22, 2021, 4:07pm UTC



---

<div class="post-metadata">

**Author:** ![Eugene\_R](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/eugene_r/32/17211_2.png) [@Eugene\_R](https://forum.babylonjs.com/u/Eugene_R)\
**Post date:** [August 12, 2021, 12:55pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/13 "2021-08-12T12:55:26Z")

</div>

@sebavan @PolygonalSun  
Hey guys. Are there any news on this one?  
This issue arises in our project quite often and in a more unpleasant form due to slightly modified controls.  
Would be really happy if it is resolved according to the discussed behavior.

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [August 12, 2021, 4:54pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/15 "2021-08-12T16:54:37Z")

</div>

I’m looking at implementing option 1 though it may require additional testing and time because we’re effectively changing the original behavior. In any case, I’ve created the an issue ([Rotation on ArcRotateCamera continues when button is released if another button is still active · Issue #10856 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/issues/10856)) so that it’s progress can be tracked.

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [August 19, 2021, 10:14pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/16 "2021-08-19T22:14:18Z")

</div>

I have a fix that should change the behavior but some of our pointer unit tests are failing so I am just verifying if the tests need to be changed or if my fix is missing something. I’ll let you know when I get the PR up.

---

<div class="post-metadata">

**Author:** ![Eugene\_R](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/eugene_r/32/17211_2.png) [@Eugene\_R](https://forum.babylonjs.com/u/Eugene_R)\
**Post date:** [August 20, 2021, 10:38am UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/17 "2021-08-20T10:38:04Z")

</div>

Thanks a ton! I greatly appreciate your taking the time to resolve this stuff.

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [August 25, 2021, 6:11pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/18 "2021-08-25T18:11:33Z")

</div>

Change for this is in PR: [Modify ArcRotateCamera and FreeCamera to account for which button is pressed by PolygonalSun · Pull Request #10926 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/10926)

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [August 26, 2021, 6:46pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/19 "2021-08-26T18:46:15Z")

</div>

PR merged

---

<div class="post-metadata">

**Author:** ![PolygonalSun](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/polygonalsun/32/2704_2.png) [@PolygonalSun](https://forum.babylonjs.com/u/PolygonalSun)\
**Post date:** [August 26, 2021, 6:46pm UTC](https://forum.babylonjs.com/t/camera-rotation-is-stuck-because-of-pointerinput-fakemove/22171/20 "2021-08-26T18:46:16Z")

</div>

Unassigned @PolygonalSun on August 26, 2021, 6:46pm UTC


