With the Unity tutorial I created a camera that follows a player (ball), but it’s only follows in one rotation. I wanna create a camera that not only follows a player, but rotates around a player with mouse. Here’s my code:
public GameObject player;
private Vector3 offset;
public int speed;
private void Start()
{
offset = transform.position;
Cursor.visible = false; //Hides cursor.
}
private void Update()
{
transform.LookAt(player.transform);
transform.RotateAround(player.transform.position, Vector3.up, Input.GetAxis("Mouse X") * speed);
}
Thanks in advance!