Quaternion
Inherits from Object. Is a struct, meaning that assignments will create copies and comparisons will return true if all fields are equivalent.
Initialization
Quaternion takes four floats X, Y, Z and W as parameters when initializing.
Example: quaternion = Quaternion(0.5, 0.5, 0.5, 0.5);
Fields
X
float
false
X value of the quaternion.
Y
float
false
Y value of the quaternion.
Z
float
false
Z value of the quaternion.
W
float
false
W value of the quaternion.
Euler
Vector3
true
Returns the euler angles of the quaternion as a Vector3.
Static Fields
Can be accessed by referencing Quaternion directly (example: Quaternion.Identity)
Identity
Quaternion
Returns the identity quaternion (0,0,0,0).
Static functions
Lerp(a: Quaternion, b: Quaternion, t: float)
Quaternion
Returns a Quaternion lerped between a and b using scale t. T must be between 0 and 1.
LerpUnclamped(a: Quaternion, b: Quaternion, t: float)
Quaternion
Returns a Quaternion lerped between a and b using scale t. T can be outside 0 and 1.
Slerp(a: Quaternion, b: Quaternion, t: float)
Quaternion
Returns a Quaternion spherical lerped between a and b using scale t. T must be between 0 and 1.
SlerpUnclamped(a: Quaternion, b: Quaternion, t: float)
Quaternion
Returns a Quaternion spherical lserped between a and b using scale t. T can be outside 0 and 1.
FromEuler(v: Vector3)
Quaternion
Returns the Quaternion rotation from the given euler angles.
LookRotation(forward: Vector3, [optional] up: Vector3)
Quaternion
Returns the Quaternion rotation with the specified forward and (optional) up Vector.
FromToRotation(from: Vector3, to: Vector3)
Quaternion
Returns the Quaternion rotation between the from and to Vector.
Inverse(a: Quaternion)
Quaternion
Returns the inverse of the given Quaternion.
RotateTowards(from: Quaternion, to: Quaternion, maxDegrees: float)
Quaternion
Returns the quaternion rotated towards To with a maximum degree change.
Last updated