用户工具

站点工具


侧边栏



Unity3D中文文档

script:unityengine:classes:quaternion:quaternion

Quaternion 四元数

struct in UnityEngine

Description 描述

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表示所有旋转。

They are based on complex numbers and are not easy to understand intuitively. 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) 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 are: Quaternion.LookRotation, Quaternion.Angle, Quaternion.Euler, Quaternion.Slerp, Quaternion.FromToRotation, and Quaternion.identity. (The other functions are only for exotic uses.)

他们基于复数并且直觉上不容易理解。你几乎不必要进入或者修改个人的四元数组件(x,y,z,w);通常你只需把现有的旋转(例如,来自Transform)并使用它们来构造新的旋转(例如,在两个旋转间平滑地插值)。四元数函数你99%的时间你会使用它(其他函数仅额外使用)Quaternion.LookRotation, Quaternion.Angle, Quaternion.Euler, Quaternion.Slerp, Quaternion.FromToRotation, Quaternion.identity。

You can use the Quaternion.operator * to rotate one rotation by another, or to rotate a vector by a rotation.

你可以使用Quaternion.operator *由另一个四元数来旋转一个旋转角度,或由一个旋转角度来旋转一个向量。

Static Variables 静态变量

identityThe identity rotation (Read Only).
同一性旋转(只读)。

Variables 变量

eulerAnglesReturns the euler angle representation of the rotation.
返回表示旋转的欧拉角度。
this[int]Access the x, y, z, w components using [0], [1], [2], [3] respectively.
分别使用 [0]、[1]、 [2]、 [3],访问x、y、z、w组件。
wW component of the Quaternion. Don't modify this directly unless you know quaternions inside out.不
四元数的W组件。不要直接修改这个,除非你很了解四元数。
xX component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
四元数的X组件。不要直接修改这个,除非你很了解四元数。
yY component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
四元数的Y组件。不要直接修改这个,除非你很了解四元数。
zZ component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
四元数的Z组件。不要直接修改这个,除非你很了解四元数。

Constructors 构造器

QuaternionConstructs new Quaternion with given x,y,z,w components.
用给定的x、y、z、w组件,构造新的四元数。

Public Functions 共有函数

SetSet x, y, z and w components of an existing Quaternion.
设置存在的四元素的x, y, z 和w 组件。
SetFromToRotationCreates a rotation which rotates from fromDirection to toDirection.
创建一个从fromDirection到toDirection的旋转。
SetLookRotationCreates a rotation with the specified forward and upwards directions.
创建一个旋转,沿着forward(z轴)并且头部沿着up(y轴)的约束注视。也就是建立一个旋转,使z轴朝向view y轴朝向up。
ToAngleAxisConverts a rotation to angle-axis representation (angles in degrees).
转换一个旋转用“角-轴”表示。
ToStringReturns a nicely formatted string of the Quaternion.
返回一个格式化好的四元数字符串。

Static Functions 静态函数

AngleReturns the angle in degrees between two rotations a and b.
返回a和b两者之间的角度。
AngleAxisCreates a rotation which rotates angle degrees around axis.
绕axis轴旋转angle,创建一个旋转。
DotThe dot product between two rotations.
两个旋转之间的点乘。
EulerReturns 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度(像这样的顺序)。
FromToRotationCreates a rotation which rotates from fromDirection to toDirection.
从fromDirection到toDirection创建一个旋转。
InverseReturns the Inverse of rotation.
返回反向的旋转。
LerpInterpolates between from and to by t and normalizes the result afterwards.
通过t值from向to之间插值,并且规范化结果。
LookRotationCreates a rotation with the specified forward and upwards directions.
创建一个旋转,沿着forward(z轴)并且头部沿着upwards(y轴)的约束注视。也就是建立一个旋转,使z轴朝向view y轴朝向up。
RotateTowardsRotates a rotation from towards to.
旋转一个角度从from向to。
SlerpSpherically interpolates between from and to by t.
球形插值,通过t值from向to之间插值。参数取值范围[0,1]。
SlerpUnclampedSpherically interpolates between a and b by t. The parameter t is not clamped.
球形插值,通过t值from向to之间插值。该参数t是不在区间内。

Operators 运算符

operator !=Are two quaternions different from each other?
判断两个四元数是否不同?
operator *Combines rotations lhs and rhs.
获取lhs 的旋转状态并应用rhs的旋转。
operator ==Are two quaternions equal to each other?
判断两个四元数是否相等?
script/unityengine/classes/quaternion/quaternion.txt · 最后更改: 2016/08/02 05:28 (外部编辑)