Unity3d之Quaternion 学习与应用(转)
来源:互联网 发布:刀具设计软件 编辑:程序博客网 时间:2024/05/16 02:41
function Rotate (eulerAngles : Vector3, relativeTo : Space = Space.Self) : void
Description
Converts a rotation to angle-axis representation
这个函数的作用就是返回物体的旋转角度(物体的z轴和世界坐标z轴的夹角)和三维旋转轴的向量到变量out angle 和out axis
Description
Creates a rotation which rotates from fromDirection to toDirection.
这个函数的作用是把物体的fromDirection旋转到toDirection
Description
Creates a rotation that looks along forward with the the head upwards along upwards
Logs an error if the forward direction is zero.
这个函数建立一个旋转使z轴朝向view y轴朝向up。这个功能让我想起了Maya里的一种摄像机lol,大家自己玩好了,很有趣。
Description
Returns a nicely formatted string of the Quaternion
这个一般用不着吧?看不懂的一边查字典去~
Class Functions
1)四元数乘法 *
建议非特别了解的人群就不要用了。
作用很简单,c=a*b (c,a,b∈Quaternion)可以理解为 ∠c=∠a+∠b
但是a*b 和b*a效果不一样的。
2) == 和 !=
不解释了
3)static function Dot (a : Quaternion, b : Quaternion) : float
Description
The dot product between two rotations
点积,返回一个float. 感觉用处不大。Vector3.Angle()比较常用。
4)static function AngleAxis (angle : float, axis : Vector3) : Quaternion
Description
Creates a rotation which rotates angle degrees around axis.
物体沿指定轴向axis旋转角度angle, 很实用的一个函数也是。
5)static function FromToRotation (fromDirection : Vector3, toDirection : Vector3) : Quaternion
Description
Creates a rotation which rotates from fromDirection to toDirection.
Usually you use this to rotate a transform so that one of its axes eg. the y-axis - follows a target direction toDirection in world space.
跟SetFromToRotation差不多,区别是可以返回一个Quaternion。通常用来让transform的一个轴向(例如 y轴)与toDirection在世界坐标中同步。
6)static function LookRotation (forward : Vector3, upwards : Vector3 = Vector3.up) : Quaternion
Description
Creates a rotation that looks along forward with the the head upwards along upwards
Logs an error if the forward direction is zero.
跟SetLootRotation差不多,区别是可以返回一个Quaternion。
7)static function Slerp (from : Quaternion, to : Quaternion, t : float) : Quaternion
Description
Spherically interpolates from towards to by t.
从from 转换到to,移动距离为t。也是很常用的一个函数,用法比较多,个人感觉比较难控制。当两个quaternion接近时,转换的速度会比较慢。
Description
Interpolates from towards to by t and normalizes the result afterwards.
This is faster than Slerp but looks worse if the rotations are far apart
跟Slerp相似,且比Slerp快,.但是如果旋转角度相距很远则会看起来很差。
8)static function Inverse (rotation : Quaternion) : Quaternion
Description
Returns the Inverse of rotation.
返回与rotation相反的方向
9)static function Angle (a : Quaternion, b : Quaternion) : float
Description
Returns the angle in degrees between two rotations a and b.
计算两个旋转之间的夹角。跟Vector3.Angle() 作用一样。
10)static function Euler (x : float, y : float, z : float) : Quaternion
Description
Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).
把旋转角度变成对应的Quaternion
- Unity3d之Quaternion 学习与应用(转)
- Unity3d之Quaternion 学习与应用
- Unity3D之Quaternion学习与应用
- Unity3d之Quaternion 学习与应用
- Unity3D Quaternion 学习与应用
- Quaternion 学习与应用
- Quaternion 学习与应用
- Quaternion 学习与应用
- Quaternion 学习与应用
- Unity3d之Vector3 学习与应用
- Unity3d 学习与应用之 DEBUG
- Unity3d 学习与应用之 DEBUG
- Unity3d 学习与应用之 DEBUG
- Unity3D中的Quaternion(四元数)
- Unity3D中的Quaternion(四元数)
- Unity3D中的Quaternion(四元数)
- (转)Unity3D Quaternion各属性和函数测试
- unity3d Quaternion
- iOS8开发~UI布局(二)storyboard中autolayout和size class的使用详解
- ——Diary3(Java基础语法2——语句,函数,数组)
- iOS8开发~UI布局(三)深入理解autolayout
- Java之泛型篇
- 0/1背包问题的动态规划法求解 —— Java 实现
- Unity3d之Quaternion 学习与应用(转)
- Ubuntu下解决USB不能自动识别问题
- 一个技术人的知识管理方法论
- ZOJ 3825 Garden and Sprinklers(直线与圆相交)
- jquerymobile1.4开发过程中遇到的一些问题总结
- hdu 2098 分拆素数和 水题
- Java之反射篇
- Android 自定义View并添加属性
- 2299 Ultra-QuickSort(归并排序)