Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Quaternion 四元数
# Quaternion 四元数 Struct Quaternions are used to represent rotations. 四元数用于表示旋转。 They are compact, don't suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations. 它们是紧凑的,不会出现万向节锁并且能够很容易被插值。Unity 内使用 Quaternion 表示所有旋转。 However, they are based on complex numbers and are not easy to understand intuitively. Thus you almost never access or modify individual Quaternion components (x,y,z,w); most often you would just take existing rotations (e.g. from the [Transform](../Transform/Transform.html)) and use them to construct new rotations (e.g. to smoothly interpolate between two rotations). The Quaternion functions that you use 99% of the time (The other functions are only for exoctic uses) [Quaternion.LookRotation](Quaternion.LookRotation.html), [Quaternion.Angle](Quaternion.Angle.html), [Quaternion.Euler](Quaternion.Euler.html), [Quaternion.Slerp](Quaternion.Slerp.html), [Quaternion.FromToRotation](Quaternion.FromToRotation.html), [Quaternion.identity](Quaternion.identity.html) 然而,它们基于复数的并不容易被直观地理解,因此你没有必要访问或修改单个 Quaternion 组件(x,y,z,w);通常你只需把现有的旋转(例如,来自 Transform)并使用它们来构造新的旋转(例如,在两个旋转间平滑地插值)。四元数函数你 99% 的时间你会使用它(其他函数仅额外使用)[Quaternion.LookRotation](Quaternion.LookRotation.html), [Quaternion.Angle](Quaternion.Angle.html), [Quaternion.Euler](Quaternion.Euler.html), [Quaternion.Slerp](Quaternion.Slerp.html), [Quaternion.FromToRotation](Quaternion.FromToRotation.html), [Quaternion.identity](Quaternion.identity.html)。 You can use [Quaternion.operator *](Quaternion.operator_multiply.html) to rotate one rotation by another, or to rotate a vector by a rotation. 你可以使用 [Quaternion.operator *](Quaternion.operator_multiply.html)由另一个四元数来旋转一个旋转角度,或由一个旋转角度来旋转一个向量。 ### Variables**变量** * [x](Quaternion.x.html) X component of the Quaternion. Don't modify this directly unless you know quaternions inside out. 四元数的 X 组件。不要直接修改这个,除非你很了解四元数。 * [y](Quaternion.y.html) Y component of the Quaternion. Don't modify this directly unless you know quaternions inside out. 四元数的 Y 组件。不要直接修改这个,除非你很了解四元数。 * [z](Quaternion.z.html) Z component of the Quaternion. Don't modify this directly unless you know quaternions inside out. 四元数的 Z 组件。不要直接修改这个,除非你很了解四元数。 * [w](Quaternion.w.html) W component of the Quaternion. Don't modify this directly unless you know quaternions inside out. 四元数的 W 组件。不要直接修改这个,除非你很了解四元数。 * [this [int index]](Quaternion.Index_operator.html) Access the x, y, z, w components using [0], [1], [2], [3] respectively. 分别使用 [0]、[1]、 [2]、 [3],访问 x、y、z、w 组件。 * [eulerAngles](Quaternion.eulerAngles.html) Returns the euler angle representation of the rotation. 返回表示旋转的欧拉角度。 ### Constructors**构造器** * [Quaternion](Quaternion.Quaternion.html) Constructs new Quaternion with given x,y,z,w components. 用给定的 x、y、z、w 组件,构造新的四元数。 ### Functions**函数** * [ToAngleAxis](Quaternion.ToAngleAxis.html) Converts a rotation to angle-axis representation. 转换一个旋转用“角-轴”表示。 * [SetFromToRotation](Quaternion.SetFromToRotation.html) Creates a rotation which rotates from fromDirection to toDirection. 创建一个从 fromDirection 到 toDirection 的旋转。 * [SetLookRotation](Quaternion.SetLookRotation.html) Creates a rotation that looks along forward with the the head upwards along upwards 创建一个旋转,沿着 forward(z 轴)并且头部沿着 up(y 轴)的约束注视。 * [ToString](Quaternion.ToString.html) Returns a nicely formatted string of the Quaternion 返回一个格式化好的四元数字符串。 ### Class Variables**类变量** * [identity](Quaternion.identity.html) The identity rotation (Read Only). This quaternion corresponds to "no rotation": the object 返回恒等式旋转(只读)。这个四元数对于“无旋转”:这个物体完全对齐于世界或父轴。 ### Class Functions**类函数** * [operator *](Quaternion.operator_multiply.html) Combines rotations lhs and rhs. 组合旋转 lhs 和 rhs。 * [operator ==](Quaternion.operator_eq.html) Are two quaternions equal to each other? 两个四元数相等? * [operator !=](Quaternion.operator_ne.html) Are two quaternions different from each other? 两个四元数是不相等的? * [Dot](Quaternion.Dot.html) The dot product between two rotations. 两个旋转之间的点乘。 * [AngleAxis](Quaternion.AngleAxis.html) Creates a rotation which rotates angle degrees around axis. 绕 axis 轴旋转 angle,创建一个旋转。 * [FromToRotation](Quaternion.FromToRotation.html) Creates a rotation which rotates from fromDirection to toDirection. 从 fromDirection 到 toDirection 创建一个旋转。 * [LookRotation](Quaternion.LookRotation.html) Creates a rotation that looks along forward with the the head upwards along upwards 创建一个旋转,沿着 forward(z 轴)并且头部沿着 upwards(y 轴)的约束注视。 * [Slerp](Quaternion.Slerp.html) Spherically interpolates from towards to by t. 球形插值,通过 t 值 from 向 to 之间插值。 * [Lerp](Quaternion.Lerp.html) Interpolates from towards to by t and normalizes the result afterwards. 通过 t 值 from 向 to 之间插值,并且规范化结果。 * [RotateTowards](Quaternion.RotateTowards.html) Rotates a rotation from towards to. 旋转一个角度从 from 向 to。 * [Inverse](Quaternion.Inverse.html) Returns the Inverse of rotation. 返回反向的旋转。 * [Angle](Quaternion.Angle.html) Returns the angle in degrees between two rotations a and b. 返回 a 和 b 两者之间的角度。 * [Euler](Quaternion.Euler.html) 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). 返回一个旋转角度,绕 z 轴旋转 z 度,绕 x 轴旋转 x 度,绕 y 轴旋转 y 度(像这样的顺序)。
da
2022年5月23日 14:39
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码