- Home /
Accessing the z axis of Rotation in Debug
I am trying to access the z-axis of the transform Rotation component so I can see the information on the console.`#pragma strict
var global = RobotMove.RotateSpeed;
var data: float = 0;
function Update () {
transform.Rotate (Vector3( 0, 0, Input.GetAxis("Mouse Y") * global * Time.deltaTime));
Debug.Log(transform.Rotate.z);
}`
Comment
Best Answer
Answer by robertbu · Apr 18, 2014 at 09:12 PM
You want:
Debug.Log(transform.eulerAngles.z);
Note that the value output may not be the one you expect. There are multiple euler angles for any given physical rotation, and Unity sometimes changes to a different representation from the one set.