threeVR
threeVR copied to clipboard
Set min and max angles for camera
It would be great if there was an API to set max and min horizontal and vertical rotation. For example, if I wanted my camera to rotate from [Math.PI, 0]
on the y-axis. Orbit Controls has the ability to camera.minPolarAngle
or camera.maxAzimuthAngle
Out of curiosity has anyone managed to solve this issue?
@ob6160 I didn't actually, I just changed my application to get around the issue, which wasn't the best solution
If I knew more maths than I did I'd have a go at solving this haha
@ob6160 haha same, I haven't taken linear algebra yet :stuck_out_tongue:
I found a solution which works for me :)
After the quaternion has been set, to limit the rotation of the camera on either side I just ran this:
this.object.rotation.y = Math.min(Math.max(this.object.rotation.y, -Math.PI*0.5), Math.PI*0.5);