Skip to content

Quaternion

new Quaternion(x?, y?, z?, w?)

THREE equivalent: THREE.Quaternion

Unit quaternion for rotation. Synced with Euler on Node via onChange callbacks. All mutation methods return this for chaining.

Differs from THREE.js

premul() instead of premultiply(). No slerp instance method - slerp is handled by QuaternionTrack.

Name Type Description
x number X component.
y number Y component.
z number Z component.
w number W component. Default 1.
length number Euclidean length (read-only).
Method Description
set(x: number, y: number, z: number, w: number): this Sets all four components.
setFromAxisAngle(axis: Vector3, angle: number): this Sets the quaternion from an axis and rotation angle.
setFromEuler(euler: Euler): this Sets the quaternion from Euler angles.
setFromRotationMatrix(m: Matrix4): this Extracts the rotation quaternion from a matrix.
normalize(): this Normalizes to unit length.
invert(): this Conjugates the quaternion (inverts for unit quaternions).
premul(q: Quaternion): this Pre-multiplies this quaternion by q.
clone(): Quaternion Returns a new Quaternion with the same components.