I have a script for my camera on my player so that the camera can move up and down on the y axis. I don’t want the camera to move left and right because my player already rotates left and right on the x axis and the camera follows because it is the players child. Now the problem is that the camera rotates too far up or too far down which is why I need a clamp or bonds for it. I have looked all over Google and other sites but I can not find anything the fits what I’m looking for. All I need is a clamp on the y axis when input axis horizontal is pushed but I also want the camera to follow the player when it moves up and down. Thanks for your help, here’s my script.
private var player : Transform;
private var speed : float = 10;
function Update() {
player = GameObject.Find("Gabriel Health Bar Red").transform;
transform.LookAt(player);
var translation = Input.GetAxis ("Mouse Y") * speed;
translation *= Time.deltaTime;
transform.Translate (0, translation, 0);
}