I am trying to rotate a camera around an object but stop when the angle hits 90 degrees in the y-axis.
I have found options like "RotateTowards": https://docs.unity3d.com/ScriptReference/Quaternion.RotateTowards.html, and options like "RotateAround": https://docs.unity3d.com/ScriptReference/Transform.RotateAround.html, but I am trying to find a way to combine both.
Code I have tried but that hasn't successfully worked:
void Update()
{
if (cameraChange && transform.rotation.y != 90)
{
// transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(0, 90f, 0), Time.deltaTime * speed);
transform.rotation.RotateAround(player.transform.position, new Vector3(0, 1, 0), Time.deltaTime * speed);
}
}
void GameOver()
{
cameraChange = true;
transform.LookAt(player.transform);
}