# Transform.localEulerAngles 自身欧拉角

var localEulerAngles : Vector3

Description描述

The rotation as Euler angles in degrees relative to the parent transform's rotation.

The x, y, and z angles represent a rotation z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).

x、y、z角代表绕z轴旋转z度，绕x轴旋转x度，绕y轴旋转y度（这个顺序）。

Only use this variable to read and set the angles to absolute values. Don't increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotate instead.

``````using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
public void Awake() {
print(transform.localEulerAngles.x);
print(transform.localEulerAngles.y);
print(transform.localEulerAngles.z);
}
}``````
``````// Print the rotation around the parent's X Axis
//打印绕父级的X轴的旋转角度
print (transform.localEulerAngles.x);
// Print the rotation around the parent's Y Axis
//打印绕父级的Y轴的旋转角度
print (transform.localEulerAngles.y);
// Print the rotation around the parent's Z Axis
//打印绕父级的Z轴的旋转角度
print (transform.localEulerAngles.z);``````

Unity automatically converts the angles to and from the rotation stored in Transform.localRotation

Unity会从Transform.localRotation这个四元组结构中转换角度到欧拉角的表达方式，或者反过来。

Page last updated: 2010-12-18