I am using Three.js. I have a camera which is moved and rotated the following ways:
camera.translateX()
: move left/rightcamera.translateZ()
: move forward/backwardcamera.rotateY()
: rotate left/rightcamera.rotateX()
: rotate up/down
After some movements and rotations, I want to reset the camera's up/down rotation (i.e. it will neither looking at the sky or the floor) so that it is viewing horizontally, while maintaining the current left/right rotation and position.
My question is how could I get the proper value for camera.rotateX()
?
Or is there any way to specify the exact angle it should rotate to?
I have tried camera.quaternion.setFromAxisAngle()
but it seems not what I want because it also change/set the left/right rotation of the camera.