- Home /
Question by
joshazking · Nov 28, 2016 at 08:03 AM ·
cameracamera-movementcamera rotatecamera-lookcameras
Camera isn't following mouse in FPS
I've got the code
public class mousecam : MonoBehaviour {
Vector2 mouseLook;
public float sensitivity = 5.0f;
GameObject character;
void Start ()
{
character = this.transform.parent.gameObject;
}
void Update ()
{
var mouse = new Vector2 (Input.GetAxisRaw ("Mouse X"), Input.GetAxisRaw ("Mouse Y"));
transform.localRotation = Quaternion.AngleAxis (-mouseLook.y, Vector3.right);
character.transform.localRotation = Quaternion.AngleAxis (mouseLook.x, character.transform.up);
}
However when I play, the camera doesn't move an inch, what's going wrong?
Comment