[SOLVED]FreeCamera vertical rotation jumps back on mouse click

I am trying to rotate the FreeCamera on the vertical axes with this code:

cam.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(0.7, 0, 0);

The rotation works, but on a mouse click into the rotated scene, the camera view jumps back to the previous orientation.


There musst be some function to update the scene after the camera rotated but I could not finde it in the forum/docs.


if (scene) {

Hm, the camera jumps as soon as I move the clicked mouse. Unfortunately the scene.render() method could not solve this behaviour.

make PG we can see your error exactly

We can already see the issue in him playground, even without using the timeout


This is because freeCamera uses a target to control its rotation.
You can actually forcefully write into its quaternion but it will be immediatly overwritten by the mouse inputs

The best option is to use setTarget directly:

ok, thanks to all of you for looking into it. So now I know, how it works :relaxed:
Really awesome, how fast questions get answered by this forum!

1 Like