Hi, we have rencently upgraded from Babylon 9.10 to 9.28 and have found that the arcrotate camera rotates less. After analizing the issue with an “agent”, this seems to be the root cause:
Babylon.js versions: works on 9.12.0, broken since 9.12.1, still present on 9.28.0 and on master.
Likely cause: #18573 “Port framerate-independent camera movement and configurable input to FreeCamera and FlyCamera”. Port framerate-independent camera movement and configurable input to FreeCamera and FlyCamera by georginahalpern · Pull Request #18573 · BabylonJS/Babylon.js · GitHub
Symptom
After upgrading, ArcRotateCamera feels different with the same settings. The same mouse drag rotates noticeably less, and the camera barely glides after the pointer is released. Mouse wheel and pinch zoom are affected in the same way.
Root cause
#18573 made TargetCamera._checkInputs() fold the input into this.movement and call movement.computeCurrentFrameDeltas(). ArcRotateCamera._checkInputs() already calls this.movement.computeCurrentFrameDeltas() itself, and then ends with super._checkInputs(). Both calls act on the same ArcRotateCameraMovement instance, so the movement is processed twice per frame:
- The first pass (ArcRotateCamera) computes the deltas and applies them to alpha/beta/radius.
- The second pass (TargetCamera) decays the velocity once more. Its deltas are written to
cameraRotation/cameraDirection, which ArcRotateCamera does not use, so they are lost.
As a result, the effective per-frame decay is inertia² instead of inertia, and the total rotation for a given drag drops accordingly. Total rotation is input / (1 - inertia) on 9.12.0 and input / (1 - inertia²) from 9.12.1 on. With the default inertia = 0.9 that is roughly half of the rotation (0.9 behaves as 0.81). With inertia = 0.7 it is about 40% less.
In #18573 the only change to arcRotateCamera.pure.ts is the override modifier on movement, and its description says the default camera feel is preserved, so this looks unintended.
Repro (Playground)
It scripts a 300 px horizontal drag with the default camera settings and logs the result next to the value expected with single and double processing. The Playground only offers the latest 9.x, but the v8 entry of the version selector shows the previous behavior (the call counter is skipped where camera.movement does not exist).