Which kind of "degree" i got when i use transform.rotation.z ?

Hi, i got stuck with my program, so i wrote some test program where i used some rotation. After each step, i read transform.rotation.z but i did not get the trick what kind of dimension that is:

player1.transform.Rotate (0f, 0f, 0f, Space.Self);
float angleZ = player1.transform.rotation.z;
Debug.Log (angleZ); // 0, this is ok
player1.transform.Rotate (0f, 0f, 45.0f,Space.Self);
angleZ = player1.transform.rotation.z;
Debug.Log (angleZ); // value is 0,38
player1.transform.Rotate (0f, 0f, 45.0f, Space.Self);
angleZ = player1.transform.rotation.z;
Debug.Log ("90 Degree: " + angleZ); // value is 0.70
player1.transform.Rotate (0f, 0f, 45.0f, Space.Self);
angleZ = player1.transform.rotation.z;
Debug.Log (angleZ); // 0.92
player1.transform.Rotate (0f, 0f, 45.0f, Space.Self);
angleZ = player1.transform.rotation.z;
Debug.Log ("180 Degree: " + angleZ); // 1

It is not a sinus, because sin(90) = 1 and sin (180) = 0 but very similar?

Thanks in advance.

You’re not getting a rotation you can understand by itself, because transform.rotation is a quaternion, so when you get transform.rotation.z you’re getting part of a quaternion, where what you’re expecting would be euler angles. To get the euler angle representation, you need to transform the quaternion to euler angles. Luckily, Unity has given you a shortcut to do this; you can get the euler angles by using transform.eulerAngles/transform.localEulerAngles. This will give you rotation in the degrees you’re expecting (90 degrees = right angle).