(x, y, z, w). Bone rotations come as quaternions. Global class, no import.
Overview
Common
from, set, mul, lerp, normalize…Creating
identity, fromAngles, fromAxisAngle.Using
rotate, slerp, toAngles, toAxisAngle.Common
Every argument takes anyQuatLike, not just a Quaternion.
Only
set() and normalize() change the value. Nothing changes its arguments.
Unlike the other classes, mul and div with a quaternion compose rotations (below). lerp takes the shorter arc and returns a unit quaternion.
mul
a.mul(b) applies b first, then a, and a.div(b) is a * b⁻¹.
Creating
fromAxisAngle
degrees around axis. The axis doesn’t need to be unit length.
Using
rotate
vector turned by this rotation. Expects a unit quaternion, so normalize() one you built by hand.
slerp
t isn’t clamped. lerp is cheaper and close enough for small steps.
toAngles
0–360 degrees.