Reputation: 9169
I am using THREE.js for a VR game and I would like to lock the rotation of the camera on the y-axis between two angles. I don't want the user to see behind them but instead look left and right. I'm not sure how the coordinate system works for the camera, but here is a picture of what I want.
I'm using threeVR which does not have max and min settings so I'm resorting to manually locking my camera's rotation in the update
function of my program, but I don't know how.
Upvotes: 0
Views: 110
Reputation: 2747
Can you not just lock the angle with a min/max in the update loop?
camera.rotation.y = Math.max(startAngle, Math.min(endAngle, camera.rotation.y));
Upvotes: 0