Quaternion

struct in UnityEngine

Cambiar al Manual

Descripción

Los cuaterniones se usan para representar rotaciones.

They are compact, don't suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations.

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.)

Usted puede utilizar el Quaternion.operator * para girar una rotación con otra, o para girar un vector por una rotación.

Note that Unity expects Quaternions to be normalized.

Variables Estáticas

identityLa rotación identidad (Lectura solamente).

Variables

eulerAnglesReturns or sets the euler angle representation of the rotation.
normalizedReturns this quaternion with a magnitude of 1 (Read Only).
this[int]Accede los componentes x, y, z, w utilizando [0], [1], [2], [3] respectivamente.
wW component of the Quaternion. Do not directly modify quaternions.
xComponente X del Quaternion. No lo modifique directamente al menos de que sepa quaternions de adentro hacia afuera.
yComponente Y del Quaternion. No lo modifique directamente al menos de que usted sepa quaternions de adentro hacia afuera.
zComponente Z del Quaternion. No lo modifique directamente al menos de que usted sepa quaternions de adentro hacia afuera.

Constructores

QuaternionConstruye un nuevo Quaternion con los componentes x,y,z,w dados.

Funciones Públicas

SetEstablece los componentes x, y, z y w de un Quaternion existente.
SetFromToRotationCrea una rotación que gira desde fromDirection a toDirection.
SetLookRotationCrea una rotación con las direcciones forward y upwards especificadas.
ToAngleAxisConvierte una rotación a una representación ángulo-eje (ángulos en grados).
ToStringReturns a formatted string of the Quaternion.

Funciones Estáticas

AngleRetorna el ángulo en grados entre las rotaciones a y b.
AngleAxisCrea una rotación que gira angle grados alrededor del axis.
DotEl producto punto entre dos rotaciones.
EulerReturns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis; applied in that order.
FromToRotationCrea una rotación que gira desde fromDirection a toDirection.
InverseRetorna el Inverso de rotation.
LerpEsfericamente interpola entre a y b por t y normaliza el resultado después. El parámetro t está sujeto al rango [0, 1].
LerpUnclampedEsfericamente interpola entre a y b por t y normaliza el resultado después. El parámetro t no está sujeto al rango [0, 1].
LookRotationCrea una rotación con las direcciones forward y upwards especificadas.
NormalizeConverts this quaternion to one with the same orientation but with a magnitude of 1.
RotateTowardsGira una rotación from hacia to.
SlerpSpherically interpolates between quaternions a and b by ratio t. The parameter t is clamped to the range [0, 1].
SlerpUnclampedEsfericamente interpola entre a y b por t. El parámetro t no está sujeto al rango [0, 1].

Operadores

operator *Combina rotaciones lhs y rhs.
operator ==¿Son dos quaternions iguales entre sí?
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961