unity里面的旋转

(1)Transform.eulerAngles 欧拉角

官方解释是:

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.Rotate instead.

表示沿xyz方向旋转的角度。

(2)Quaternion.AngleAxis

public static Quaternion AngleAxis(float angle, Vector3 axis);

其中参数angle为旋转角;参数axis为轴向量。

官方描述:Creates a rotation which rotates angle degrees around axis.

按照角度和轴向量创建一个旋转。

(3)Quaternion.ToAngleAxis

public void ToAngleAxis(out float angle, out Vector3 axis);

其中参数angle为旋转角;参数axis为轴向量。

官方描述:Converts a rotation to angle-axis representation (angles in degrees).

功能说明:此方法用于将Quaternion实例转换为角轴表示。在transform. rotation.ToAngleAxis(out angle, out axis)中输出值angle和axis的含义为:要将GameObject对象的rotation从Quaternion.Identity状态变换到当前状态,只需要将GameObject对象绕着axis的轴向(指世界坐标系中)旋转angle角度即可。

提示:此方法通常和静态方法AngleAxis (angle: float, axis : Vector3)联合使用,使得一个物体的rotation始终和另一个物体的rotation保持一致。

(4)Vector3.magnitude  

描述:The length of the vector is square root of (x*x+y*y+z*z). 向量的模。

(5)Unity四元数和向量相乘作用及其运算规则

效果:

作用:四元数和向量相乘表示这个向量按照这个四元数进行旋转之后得到的新的向量。

比如:向量vector3(0,0,10),绕着Y轴旋转90度,得到新的向量是vector3(10,0,0)。

在unity中表示为:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值