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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值