Rotate to Euler angle?

Unity beginner here. It seems to me the eulers in Transform.Rotate are relative, not absolute (as per description: “Applies a rotation of eulerAngles…”), that is,

public void Rotate(float xAngle, float yAngle, float zAngle, Space relativeTo = Space.Self/Space.World);

rotates the game object by, rather than to (xAngle, yAngle, zAngle). Is this correct? If yes, what is the “rotate to” API?

You just write:

transform.rotation = Quaternion.Euler(x,y,z);
or
transform.localRotation = Quaternion.Euler(x,y,z);

Sidenote, you should be aware of how much Euler angles suck for most purposes.

2 Likes