Search code examples
c#unity-game-enginegame-engine

How to get an objects rotation in degrees? Unity


When I run this: Debug.Log(playerCenter.transform.rotation); It gives a result that has four values. Each of those values are between -1 and 1. How do I just get the x y and z values in degrees.

Also what is the fourth value?


Solution

  • Have you tried playerCenter.transform.rotation.eulerAngle? or maybe playerCenter.transform.eulerAngle. Also about the fourth value, are you refering to the fourth parameter of Quaternion? e.g. Quaternion (float x, float y, float z, float w)?