Quaternion
Represents a rotation. Expected to be normalized.
Setting any component triggers an internal change callback (used to sync with Euler on Object3D).
Constructor
const q = new Quaternion(x, y, z, w) // defaults to (0, 0, 0, 1) (identity)
Properties
x,y,z,w— Quaternion componentsisQuaternion— Type flag (true)
Static Methods
Quaternion.slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t)— SLERP on flat arraysQuaternion.multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1)— Multiply on flat arrays
Methods
Setting
set(x, y, z, w),copy(q),identity()setFromEuler(euler, update?)— From Euler anglessetFromAxisAngle(axis, angle)— From axis + anglesetFromRotationMatrix(m)— From 4x4 rotation matrixsetFromUnitVectors(vFrom, vTo)— Rotation between two directionsfromArray(array, offset?),fromBufferAttribute(attribute, index)
Arithmetic
multiply(q)— Post-multiplypremultiply(q)— Pre-multiplymultiplyQuaternions(a, b)— Multiply two quaternions, store result
Operations
dot(q)— Dot productlength(),lengthSq()— Magnitudenormalize()— Normalize to unit lengthinvert()— Invert (via conjugate, assumes unit length)conjugate()— Negate x, y, z
Interpolation
slerp(qb, t)— Spherical lerp towardqbslerpQuaternions(qa, qb, t)— Slerp between two quaternionsrotateTowards(q, step)— Step toward target by angular amountangleTo(q)— Angle between quaternions in radians
Other
random()— Uniformly random rotationequals(q),clone()toArray(array?, offset?),toJSON()