A rotation quaternion, layout-compatible with what GET_ENTITY_QUATERNION / SET_ENTITY_QUATERNION expect.

Most gameplay code should stay in Euler degrees (Entity.rotation), since that's what the game itself exposes. Reach for quaternions when you need interpolation that doesn't gimbal-lock — smooth camera swings, attached object alignment, or blending between two orientations over time.

Euler conversions here use the game's ZXY convention (pitch = X, roll = Y, yaw = Z), matching GET_ENTITY_ROTATION with rotation order 2.

Static variables

staticread onlylength:Float

Static methods

staticinlineconjugate(this:QuaternionData):Quaternion

The inverse rotation (valid for unit quaternions, which is all this class produces).

staticinlinecopy(this:QuaternionData):Quaternion

staticinlinedot(this:QuaternionData, rhs:Quaternion):Float

staticfromAxisAngle(axis:Vector3, degrees:Float):Quaternion

Builds a rotation around axis (which is normalized first) by degrees.

staticfromEuler(rotation:Vector3):Quaternion

Builds a rotation from Euler angles in degrees (pitch, roll, yaw), ZXY order.

staticinlinefromHeading(degrees:Float):Quaternion

A yaw-only rotation matching a game heading in degrees.

staticinlinefromNative(value:Dynamic):Quaternion

staticinlineidentity():Quaternion

The do-nothing rotation.

@:op(A * B)staticmul(this:QuaternionData, rhs:Quaternion):Quaternion

Composes two rotations: a * b applies b first, then a.

staticrotate(this:QuaternionData, point:Vector3):Vector3

Rotates a vector by this quaternion.

staticslerp(this:QuaternionData, target:Quaternion, t:Float):Quaternion

Spherical interpolation towards target. Unlike lerping Euler angles, this always takes the shortest arc and keeps a constant angular speed.

statictoEuler(this:QuaternionData):Vector3

Converts back to Euler degrees (pitch, roll, yaw).

staticinlinetoString(this:QuaternionData):String