Click or drag to resize

Quat Structure

A unit quaternion used for representing 3D rotations. Quaternions need to be normalized to be used for rotation. It is similar to Basis, which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. Basis stores rotation, scale, and shearing, while Quat only stores rotation. Due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
[SerializableAttribute]
public struct Quat : IEquatable<Quat>

The Quat type exposes the following members.

Constructors
  NameDescription
Public methodQuat(Basis)
Constructs a quaternion from the given Basis.
Public methodQuat(Quat)
Constructs a quaternion from the given quaternion.
Public methodQuat(Vector3)
Constructs a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).
Public methodQuat(Vector3, Single)
Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
Public methodQuat(Single, Single, Single, Single)
Constructs a quaternion defined by the given values.
Top
Properties
  NameDescription
Public propertyStatic memberIdentity
The identity quaternion, representing no rotation. Equivalent to an identity Basis matrix. If a vector is transformed by an identity quaternion, it will not change.
Public propertyItem
Access quaternion components using their index.
Public propertyLength
Returns the length (magnitude) of the quaternion.
Public propertyLengthSquared
Returns the squared length (squared magnitude) of the quaternion. This method runs faster than Length, so prefer it if you need to compare quaternions or need the squared length for some formula.
Top
Methods
  NameDescription
Public methodCubicSlerp
Performs a cubic spherical interpolation between quaternions `preA`, this vector, `b`, and `postB`, by the given amount `t`.
Public methodDot
Returns the dot product of two quaternions.
Public methodEquals(Object) (Overrides ValueTypeEquals(Object).)
Public methodEquals(Quat)
Public methodGetEuler
Returns Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
Public methodGetHashCode (Overrides ValueTypeGetHashCode.)
Public methodGetType (Inherited from Object.)
Public methodInverse
Returns the inverse of the quaternion.
Public methodIsEqualApprox
Returns true if this quaternion and `other` are approximately equal, by running IsEqualApprox(Single, Single) on each component.
Public methodIsNormalized
Returns whether the quaternion is normalized or not.
Public methodNormalized
Returns a copy of the quaternion, normalized to unit length.
Public methodSet(Quat) Obsolete.
Public methodSet(Single, Single, Single, Single) Obsolete.
Public methodSetAxisAngle Obsolete.
Public methodSetEuler Obsolete.
Public methodSlerp
Returns the result of the spherical linear interpolation between this quaternion and `to` by amount `weight`. Note: Both quaternions must be normalized.
Public methodSlerpni
Returns the result of the spherical linear interpolation between this quaternion and `to` by amount `weight`, but without checking if the rotation path is not bigger than 90 degrees.
Public methodToString (Overrides ValueTypeToString.)
Public methodToString(String)
Public methodXform
Returns a vector transformed (multiplied) by this quaternion.
Top
Operators
Fields
  NameDescription
Public fieldw
W component of the quaternion (real part). Quaternion components should usually not be manipulated directly.
Public fieldx
X component of the quaternion (imaginary `i` axis part). Quaternion components should usually not be manipulated directly.
Public fieldy
Y component of the quaternion (imaginary `j` axis part). Quaternion components should usually not be manipulated directly.
Public fieldz
Z component of the quaternion (imaginary `k` axis part). Quaternion components should usually not be manipulated directly.
Top
See Also