Quaternion.Slerp的使用

来源:互联网 发布:mysql中nvl函数用法 编辑:程序博客网 时间:2024/05/16 10:03

Quaternion.Slerp(Quaternion from ,Quaternion to, float t)叫球面线形插值

@param from 为起始方向

@param to 为终止方向

@ param t = 0.1  可以理解为速度,通常取值为0< t <= 1



void update()

{

this.gameobject.transform.rotation = Quaternion.Slerp(from, to,t * Time.time );  // 可以把 t * Time.time 理解成速度 * 时间 等于角位移

}


四元数旋转有个重要的特性就是:会意到达终止方向的旋转角度为旋转方向


例如启示位置为(0,0,0)绕Y轴旋转200度到(0,200,0),物体会顺时针旋转160度而不是逆时针旋转200度。

0 0
原创粉丝点击