I’m trying to make the camera rotate with key clicks from a first person perspective. I’d like to tie the camera to the direction the game object is moving so that the player is always looking forward, but can still turn.
Here is what I have:
void Update () {
if (Input.GetKeyDown ("left")) {
Camera.main.transform.Rotate (Vector3.left, speed * Time.deltaTime);
}
if (Input.GetKeyDown ("right")) {
Camera.main.transform.Rotate (Vector3.right, speed * Time.deltaTime);
}
}
And I can’t figure out why this doesn’t work.