Quaternion.
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.
https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions
https://godotengine.org/asset-library/asset/678
Constructs a default-initialized quaternion with all components set to [code]0[/code].
Constructs a [Quat] as a copy of the given [Quat].
Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
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).
Constructs a quaternion from the given [Basis].
Constructs a quaternion defined by the given values.
Performs a cubic spherical interpolation between quaternions [code]preA[/code], this vector, [code]b[/code], and [code]postB[/code], by the given amount [code]t[/code].
Returns the dot product of two quaternions.
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).
Returns the inverse of the quaternion.
Returns [code]true[/code] if this quaterion and [code]quat[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component.
Returns whether the quaternion is normalized or not.
Returns the length of the quaternion.
Returns the length of the quaternion, squared.
Returns a copy of the quaternion, normalized to unit length.
Returns the result of the spherical linear interpolation between this quaternion and [code]to[/code] by amount [code]weight[/code].
[b]Note:[/b] Both quaternions must be normalized.
Returns the result of the spherical linear interpolation between this quaternion and [code]to[/code] by amount [code]weight[/code], but without checking if the rotation path is not bigger than 90 degrees.
W component of the quaternion (real part).
Quaternion components should usually not be manipulated directly.
X component of the quaternion (imaginary [code]i[/code] axis part).
Quaternion components should usually not be manipulated directly.
Y component of the quaternion (imaginary [code]j[/code] axis part).
Quaternion components should usually not be manipulated directly.
Z component of the quaternion (imaginary [code]k[/code] axis part).
Quaternion components should usually not be manipulated directly.
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.