How to set Camera limit (pivot)?


I need some help with the camera positioning. I just want to limit the pivot of the camera.
Say some units left some units right. (45° left, 45° right)

any help is desirable,

kind regards,


Assuming you mean rotation around the Y axis (so turning left and right), you can just get its rotation as a quaternion, use toAngles(float[]) to get an array with the yaw, roll, pitch.

If the yaw (rotation around Y if I’m remembering correctly but trial and error solves :D) is greater or less than whatever you want, set the rotation of the camera yourself using the fromAngles method for a Quaternion object, using 2 of the previous values and the maximum or minimum values you want to allow for rotation around Y.

thank you for explaining,