- Home /
How to limit the angle of the camera?
here is a third-person camera, her MouseOrbit script. I need to limit the angle of rotation of the camera along the axis X, with respect to the Target. Target - an object rigidbody.
You can do this:
add to script variables
public var xMinLimit : float = -120;
public var xMaxLimit : float = 120;
Add in Lateupdate
x = ClampAngle(x, xMinLimit, xMaxLimit);
and slightly lower values multiply rotation
var baseRotation : Quaternion = target.rotation;
rotation = baseRotation * Quaternion.Euler (y, x, 0);
Everything works, the rotation angle is limited as it is necessary. The problem is that the camera must not be attached to the object rigidbody. Luggage must not depend on the rotation Target. Need to angle limited, but the camera was free. I've tried a lot of things, but nothing happens. Please help. Thanks in advance for your help.
Answer by Temka193 · Dec 01, 2013 at 09:27 AM
true answer in forum http://forum.unity3d.com/threads/213762-How-to-limit-the-angle-of-the-camera?p=1435303&viewfull=1#post1435303
Your answer
Follow this Question
Related Questions
How do I create a camera similar to the one in th room of shadows example? 0 Answers
Camera parenting to rigidbody 0 Answers
vector3.forward doesn't work when used in Rigidbody? 2 Answers
camera target keep angle and y position 1 Answer
Smart camera? 1 Answer