Creates a new AnimatedQuaternion instance.
Map of animation samplers keyed by track names
The initial active animation track name
Protected
_vInternal typed array storage for quaternion components [x, y, z, w].
Whether the animation should loop when it reaches the end.
Gets the current blending ratio between animation tracks.
The current blending ratio
Sets the blending ratio between the first and second active animation tracks.
Blending ratio (0.0 = first track only, 1.0 = second track only)
Gets the class name for debugging and reflection purposes.
The string "Quaternion"
Gets the w component of the quaternion. Triggers an update before returning the value.
The w component
Gets the x component of the quaternion. Triggers an update before returning the value.
The x component
Gets the y component of the quaternion. Triggers an update before returning the value.
The y component
Gets the z component of the quaternion. Triggers an update before returning the value.
The z component
Static
compositionGets the composition type for this quaternion class.
CompositionType.Vec4 indicating this is a 4-component vector
Creates a deep copy of this quaternion.
A new quaternion with the same component values
Calculates the dot product between this quaternion and another quaternion. The dot product of two quaternions gives a scalar value that represents the cosine of half the angle between them when both quaternions are unit quaternions.
The quaternion to compute the dot product with
The dot product result
Creates a quaternion representing the rotation from one vector to another. This is an instance method version of the static fromToRotation.
The normalized quaternion representing the rotation
Gets the animation sampler for the specified track.
The animation track name
The animation sampler for the track
Checks if this quaternion is approximately equal to another quaternion within a tolerance.
The quaternion to compare with
The tolerance value (default: Number.EPSILON)
True if all components are within the tolerance, false otherwise
Checks if this quaternion is exactly equal to another quaternion.
The quaternion to compare with
True if all components are exactly equal, false otherwise
Sets or updates an animation sampler for the specified track.
The animation track name
The animation sampler to set
Converts the quaternion to Euler angles and stores the result in the output vector. The rotation order is XYZ (roll, pitch, yaw).
The output vector to store the Euler angles [x, y, z]
The output vector containing the Euler angles in radians
Transforms a 3D vector by this quaternion rotation and stores the result in the output parameter.
The vector to transform
The output vector to store the result
The output vector containing the transformed result
Static
addAdds two quaternions component-wise.
The left quaternion
The right quaternion
The sum of the two quaternions
Static
addAdds two quaternions component-wise and stores the result in the output parameter.
The left quaternion
The right quaternion
The output quaternion to store the result
The output quaternion containing the sum
Static
axisCreates a quaternion from an axis-angle representation.
The rotation axis (will be normalized internally)
The rotation angle in radians
A quaternion representing the rotation around the given axis
Static
clampClamps the rotation angle of a quaternion to a maximum value. If the quaternion's rotation angle exceeds thetaMax, it scales the rotation down.
The quaternion to clamp
The maximum allowed rotation angle in radians
A quaternion with rotation angle clamped to thetaMax
Static
divideDivides a quaternion by a scalar value.
The quaternion to divide
The scalar value to divide by (must not be zero)
A new quaternion with all components divided by the scalar
Static
divideDivides a quaternion by a scalar and stores the result in the output parameter.
The quaternion to divide
The scalar value to divide by (must not be zero)
The output quaternion to store the result
The output quaternion containing the divided result
Static
dummyCreates a dummy quaternion with zero-length internal array. Used as a placeholder or uninitialized quaternion.
A new dummy quaternion
Static
fromCreates a quaternion from an axis-angle representation.
The rotation axis vector
The rotation angle in radians
A new quaternion representing the rotation
Static
fromCreates a quaternion from an axis-angle representation and stores it in the output parameter.
The rotation axis vector
The rotation angle in radians
The output quaternion to store the result
The output quaternion containing the rotation
Static
fromCreates a quaternion from individual component values.
The x component
The y component
The z component
The w component
A new quaternion with the specified components
Static
fromCreates a quaternion from a variable-length array (taking first 4 elements).
The array containing quaternion components
A new quaternion with the first 4 components copied
Static
fromCreates a quaternion from a 4-element array.
The array containing [x, y, z, w] components
A new quaternion with copied components
Static
fromCreates a quaternion from a log quaternion representation.
The log quaternion to convert
A new quaternion converted from log space
Static
fromCreates a quaternion by copying from another quaternion.
The quaternion to copy from
A new quaternion with copied components
Static
fromCreates a quaternion by copying from a 4D vector.
The 4D vector to copy from
A new quaternion with components copied from the vector
Static
fromCreates a quaternion from a Float32Array.
The Float32Array containing quaternion components
A new quaternion using the provided array
Static
fromCreates a quaternion from a 4x4 rotation matrix. Extracts the rotation component from the matrix and converts it to quaternion form.
The 4x4 matrix containing rotation information
A quaternion representing the same rotation as the matrix
Static
fromCreates a quaternion from a 4x4 rotation matrix and stores it in the output parameter.
The 4x4 matrix containing rotation information
The output quaternion to store the result
The output quaternion containing the extracted rotation
Static
fromCreates a quaternion from a position vector, with w component set to 0. This is useful for representing pure translations in quaternion form.
The position vector
A quaternion with xyz from the vector and w=0
Static
fromCreates a quaternion representing the rotation from one vector to another (static version).
A normalized quaternion representing the rotation
Static
fromCreates a quaternion representing the rotation from one vector to another and stores it in the output parameter.
The starting direction vector
The target direction vector
The output quaternion to store the result
The output quaternion containing the normalized rotation
Static
getGets the rotation angle (0 to π) represented by a quaternion.
The quaternion to analyze (assumed to be normalized)
The rotation angle in radians
Static
identityCreates an identity quaternion representing no rotation. The identity quaternion is (0, 0, 0, 1) in (x, y, z, w) format.
A new identity quaternion
Static
invertComputes the inverse of a quaternion. For a unit quaternion, the inverse is the conjugate divided by the squared magnitude.
The quaternion to invert
The inverted quaternion, or zero quaternion if input has zero length
Static
invertComputes the inverse of a quaternion and stores the result in the output parameter.
The quaternion to invert
The output quaternion to store the result
The output quaternion containing the inverted result
Static
lerpPerforms linear interpolation (LERP) between two quaternions. Note: LERP does not maintain constant angular velocity like SLERP.
The starting quaternion
The ending quaternion
The interpolation parameter (0.0 = l_quat, 1.0 = r_quat)
The linearly interpolated quaternion
Static
lerpPerforms linear interpolation (LERP) and stores the result in the output parameter.
The starting quaternion
The ending quaternion
The interpolation parameter (0.0 = l_quat, 1.0 = r_quat)
The output quaternion to store the result
The output quaternion containing the interpolated result
Static
lookCreates a quaternion that looks in the specified forward direction using default up vector (0, 1, 0).
The forward direction vector
A quaternion representing the look rotation
Static
lookCreates a quaternion that looks in the specified forward direction with a custom up vector.
A quaternion representing the look rotation with the specified up vector
Static
lookCreates a quaternion that rotates from one direction to another.
A quaternion representing the rotation from fromDirection to toDirection
Static
multiplyMultiplies two quaternions using Hamilton's quaternion multiplication. This combines the rotations represented by both quaternions. Note: Quaternion multiplication is not commutative (order matters).
The left quaternion
The right quaternion
The product of the two quaternions
Static
multiplyMultiplies a quaternion by a scalar value.
The quaternion to multiply
The scalar value to multiply by
A new quaternion with all components multiplied by the scalar
Static
multiplyMultiplies a quaternion by a scalar and stores the result in the output parameter.
The quaternion to multiply
The scalar value to multiply by
The output quaternion to store the result
The output quaternion containing the scaled result
Static
multiplyMultiplies two quaternions and stores the result in the output parameter.
The left quaternion
The right quaternion
The output quaternion to store the result
The output quaternion containing the product
Static
normalizeNormalizes a quaternion to unit length.
The quaternion to normalize
A new normalized quaternion
Static
normalizeNormalizes a quaternion to unit length and stores the result in the output parameter.
The quaternion to normalize
The output quaternion to store the result
The output quaternion containing the normalized result
Static
qlerpPerforms spherical linear interpolation (SLERP) between two quaternions. SLERP provides smooth rotation interpolation that maintains constant angular velocity.
The starting quaternion
The ending quaternion
The interpolation parameter (0.0 = l_quat, 1.0 = r_quat)
The interpolated quaternion
Static
qlerpPerforms spherical linear interpolation (SLERP) and stores the result in the output parameter.
The starting quaternion
The ending quaternion
The interpolation parameter (0.0 = l_quat, 1.0 = r_quat)
The output quaternion to store the result
The output quaternion containing the interpolated result
Static
subtractSubtracts the right quaternion from the left quaternion component-wise.
The left quaternion
The right quaternion
The difference of the two quaternions
Static
subtractSubtracts two quaternions component-wise and stores the result in the output parameter.
The left quaternion
The right quaternion
The output quaternion to store the result
The output quaternion containing the difference
An animated quaternion that can be driven by animation samplers. This class extends the base Quaternion class to provide animation capabilities, allowing quaternion values to be interpolated over time using animation tracks. Supports blending between multiple animation tracks and both local and global time management.