ikkyo
April 24, 2019, 11:31am
1
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.
https://playground.babylonjs.com/#68CV79
There musst be some function to update the scene after the camera rotated but I could not finde it in the forum/docs.
greetings
mike
hey
try
if (scene) {
scene.render();
}
ikkyo
April 24, 2019, 1:05pm
3
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
Vinc3r
April 24, 2019, 1:10pm
5
We can already see the issue in him playground, even without using the timeout
https://playground.babylonjs.com/#68CV79#1
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:
https://playground.babylonjs.com/#68CV79#2
ikkyo
April 24, 2019, 3:18pm
7
ok, thanks to all of you for looking into it. So now I know, how it works
Really awesome, how fast questions get answered by this forum!
1 Like