I have some code here that when the Space key is held down it rotates. Rotation on the z axis starts at 0. Then gradually rises to 180. As soon as it hits 180, it turns into -179, I have figured out that it is subtracting 360 at some point.
if (Input.GetKey(KeyCode.Space))
{
aimMode = false;
transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);
}
Can someone explain this to me?