Hey!
Im very new to programing so the question might be a bit stupid.
I have a camera wich rotates around the y axis with “Mouse X” and pans up and down with “mouse Y”. I would like the camera to stop paning when it reaches: transform.position.y = 1. All of this works!..but when u keep on paning down the camera starts shaking/lagging/hacking (or whatever to call it)…I would like the camera to just stop dead even if the user keeps on paning down
Heres the code:
var horizontalSpeed : float = 2;
var verticalSpeed : float = 0.2;
function Update () {
if(Input.GetButton("Fire1"))
{
var h : float = horizontalSpeed * Input.GetAxis ("Mouse X");
var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
}
if(transform.position.y > 1)
{
transform.position.y = 1;
}
transform.position += -transform.up * v;
transform.Rotate(0, h, 0);
}