I have been working with unity and scripting in it for a couple of months or so and I can’t seem to figure out how to limit the amount of rotation the camera does on the “Y” - axis. Here is my script. If at all possible, could someone show me how to limit rotation through my script. Thanks in advanced
var horizontalSpeed : float = 7.0;
var verticalSpeed : float = 7.0;
function Update()
{
//Rotates Player on "X" Axis Acording to Mouse Input
var h : float = horizontalSpeed * Input.GetAxis ("Mouse X");
transform.Rotate (0, h, 0);
//Rotates Player on "Y" Axis Acording to Mouse Input
var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
Camera.mainCamera.transform.Rotate (v, 0, 0);
}