- Home /
Question by
Nugget_bram · Nov 07, 2014 at 05:21 AM ·
mouselooklimit
How to set y-axis limits to mouselook script
I'm using this as a mouselook script, works perfectly except for if the mouse is put to the bottom or top of the screen - it can loop all the way around.
var sensibility : float;
function Start () {
}
function Update () {
transform.Rotate(Vector3(0,Input.GetAxis("Mouse X")*sensibility,0), Space.World);
transform.Rotate(Vector3(-Input.GetAxis("Mouse Y")*sensibility,0,0));
}
How would I set a limit to ~-80 and 90 degrees?
Comment
Answer by b1gry4n · Nov 07, 2014 at 07:34 AM
This has been asked before:
http://answers.unity3d.com/questions/18680/limiting-rotation-of-an-object.html