Camera Rotation

So I’m working on a “temple run” like game with a shifting gravity mechanic but I have no idea how to get the camera to rotate so that the ground the player is currently on will always be on the bottom. I tried transforming the quaternion axis by 90 degrees but that causes my player to be off center.

public class CamFollow : MonoBehaviour {

public Transform player;
public Vector3 offset;

void Update()
{
transform.position = player.position + offset;
}
public void Rotate()
{
transform.rotation = Quaternion.Euler(0, 0, -90);
}
}

Try something like this:

void LateUpdate()
{
  transform.position = player.position + offset;
  transform.LookAt(player.position, player.up);
}

Consider using Cinemachine.

2 Likes

thank you. so far everything im researching seems to suggest that this is what i need for multiple problems.