Question by
Kousuke-shii · May 24, 2016 at 01:43 AM ·
camerarotationjavascript1st personvertical
How do you disallow an angle from going to a certain range while rotating?
So basically I'm trying to prevent my camera from looking all the way up and around and vice versa. My camera rotates horizontally with my rigidbody but the vertical rotation is separated because I placed the script in the camera itself. Here's my vertical rotation code:
function Update ()
{
CamY ();
}
function CamY ()
{
var mY = Input.GetAxis("Mouse Y") * Time.deltaTime * mouseTy;
transform.Rotate(-mY,0f,0f);
}
Basically I want to disallow my angle from going from 60-300.. Anything above and below is fine.
I'm a complete noob so It'd be better if you can explain your solution as well.. Thanks!
Comment
Your answer
Follow this Question
Related Questions
Rotate Camera only Horizontal? 1 Answer
How to LOCK/STOP Rotation on Main Camera as child of Prefab? 0 Answers
Camera Script remove a part. 0 Answers
speed = transform.rotation * speed; explanation please? 1 Answer
How to rotate camera view? 0 Answers