quaternion¶
quaternion is used to represent rotations.Properties¶
quaternion identity
A quaternion with the magnitude of zero
quaternion eulerAngles
Returns the euler angle representation of the rotation.
number x
The x-coordinate of the quaternion
number y
The y-coordinate of the quaternion
number z
The z-coordinate of the quaternion
number w
The w-coordinate of the quaternion
Functions¶
Constructs a new quaternion using the given
x, y,z and w components.
Returns the angle in degrees between two rotations
a and b.
Creates a rotation which rotates
angle degrees around axis
Returns dot Product of two rotations.
Returns 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.
Creates a rotation which rotates from
fromDirection to toDirection.
Linearly interpolates between two points.
Interpolates between the points
a and b by t. The parameter t is clamped to the range [0, 1].
aStart value, returned when t = 0.bEnd value, returned when t = 1.tInterpolation ratio.
Creates a rotation with the specified
forward and upwards directions.
Z axis will be aligned with forward, X axis aligned with cross product between forward and upwards, and Y axis aligned with cross product between Z and X.
forwardThe direction to look in.upwardsThe vector that defines in which direction up is.
Rotates a rotation from towards to.
The
from quaternion is rotated towards to by an angular step of maxDegreesDelta (but note that the rotation will not overshoot). Negative values of maxDegreesDelta will move away from to until the rotation is exactly the opposite direction.
Spherically interpolates between quaternions
a and b by ratio t. The parameter t is clamped to the range [0, 1].
aStart value, returned when t = 0.bEnd value, returned when t = 1.tInterpolation ratio.
quaternion Clone()
Returns a deep copy of this quaternion.
quaternion Inverse()
Returns the Inverse of rotation.
void Set(number x, number y, number z, number w)
Set
x, y, z and w components of an existing quaternion.
quaternion Normalize()
Returns this quaternion with a magnitude of 1
void SetNormalize()
Makes this quaternion with a magnitude of 1.
quaternion ToAngleAxis()
Converts a rotation to angle-axis representation