Hi! I’m trying to use applyQuaternion to update the camera rotation. I thought it would work similarly to setting camera.rotation.x = ...
, but when I do this.camera.applyQuaternion(quaternion);
it only causes massive flickering, and doesn’t update the rotation as I want.
This codesandbox shows the issue on a cube: three.js bare example (forked) - CodeSandbox
Can anyone point me in the right direction for using quaternions to update the camera rotation?
this.mesh.quaternion.slerp(this.quat, 0.001);
?
Thanks for your answer! Is there any reason why I can’t just assign it using applyQuaternion?
Interpolating with a super small t seems kinda hacky
To add to that, what I really want to do is to define the camera position and rotation before I render, not updating it in the render loop.
I have a set of 4 quaternion rotations and 4 translations that I wish to apply to the camera. However, no matter which code I use (camera.quaternion = …; camera.applyQuaternion(…); camera.rotation.setFromQuaternion(…);), nothing works
Not sure why you box was flickering, but maybe you shouldn’t set the rotation in the animation loop, only if you want do rotate smoothly, using slerp. (normally you would set a different rotation on an event, for example a mouse click on something).