Quaternion q = new Quaternion(0, 0, 1, 0); //相当于Quaternion(new Vector3(0, 0, 1)sin(180/2), cos(180/2)) 即:绕z轴,旋转180°,的四元数
Quaternion.AngleAxis(90, Vector3.up); //绕y轴旋转90°,的四元数
Quaternion.Euler (new Vector3(90,90,90)); //先绕z轴90°,再绕x轴90°,再绕y轴90°,的四元数
Quaternion LookRotation ( Vector3 forward, Vector3 upwards=Vector3.up )
看向target
Vector3 relativePos = target.position - transform.position; Quaternion rotation = Quaternion.LookRotation(relativePos); transform.rotation = rotation;
transform.rotation = Quaternion.AngleAxis(degrees, transform.right) * transform.rotation; //低头
Vector3 newVector = Quaternion.AngleAxis(90, Vector3.up)* transform.position; 绕y轴旋转后的位置
等同于单步执行
transform.Rotate(new Vector3(0, Y, 0));
transform.Rotate(new Vector3(X, 0, 0));
transform.Rotate(new Vector3(0, 0, Z));
引用:
http://blog.csdn.net/candycat1992/article/details/41254799
http://blog.csdn.net/liulong1567/article/details/46420285