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度。