Unity-Transform.eulerAngles

Description

The rotation as Euler angles in degrees.

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.

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.Rotateinstead.

旋转为欧拉角度(以度为单位)。

x,y和z角表示围绕z轴的旋转z度,围绕x轴的x度,以及围绕y轴的y度。(对应排序)

仅使用此变量读取并将角度设置为绝对值。 不要增加它们,因为当角度超过360度时它会失败。使用Transform.Rotate代替。


第一点:x,y,z对应的角度

1、x,y和z对应着Inspector面板上Transform组件里的Rotation对应的三个值 

2、x代表围绕z轴的旋转的度数;y代表围绕z轴的旋转的度数;z代表围绕z轴的旋转的度数;

第二点:使用

1、不要分别设置欧拉角其中一个轴(例如: eulerAngles.x = 10; ),因为这将导致偏移和不希望的旋转。当设置它们一个新的值时,要同时设置全部;

例如:(float x = 10;float y = 10;float z= 10 ;transform.eulerAngles = new Vector3(x, y, z);(10,10,10))

2、不要增加它们;(例如:transform.eulerAngles+=new Vector3(10,10,10);)(x+=10;y+=10;z+=10;transform.eulerAngles = new Vector3(x, y, z);(20,20,20))

3、如果超过360,欧拉角会默认变回从0开始;

参考地址:http://www.newbieol.com/information/1799.html

猜你喜欢

转载自blog.csdn.net/SimulationPD/article/details/84520436