BabylonJS/Babylon.js · error · ReferenceError
Quaternion.Maximize does not make sense
Error message
Quaternion.Maximize does not make sense
What it means
Quaternion.Maximize is a deliberately non-functional placeholder that always throws a ReferenceError. A component-wise maximum of quaternions has no geometric meaning for rotations, so Babylon.js keeps the static method only for API symmetry with Vector3/Vector4 and throws on any use.
Source
Thrown at packages/dev/core/src/Maths/math.vector.pure.ts:6080
*/
public static RandomToRef<T extends Quaternion>(min: number = 0, max: number = 1, ref: T): T {
return ref.copyFromFloats(RandomRange(min, max), RandomRange(min, max), RandomRange(min, max), RandomRange(min, max));
}
/**
* Do not use
* @internal
*/
public static Minimize(): Quaternion {
throw new ReferenceError("Quaternion.Minimize does not make sense");
}
/**
* Do not use
* @internal
*/
public static Maximize(): Quaternion {
throw new ReferenceError("Quaternion.Maximize does not make sense");
}
/**
* Returns the distance (float) between the quaternions "value1" and "value2".
* @param value1 value to calulate the distance between
* @param value2 value to calulate the distance between
* @returns the distance between the two quaternions
*/
public static Distance(value1: DeepImmutable<Quaternion>, value2: DeepImmutable<Quaternion>): number {
return Math.sqrt(Quaternion.DistanceSquared(value1, value2));
}
/**
* Returns the squared distance (float) between the quaternions "value1" and "value2".
* @param value1 value to calulate the distance between
* @param value2 value to calulate the distance between
* @returns the distance between the two quaternions squared
*/
public static DistanceSquared(value1: DeepImmutable<Quaternion>, value2: DeepImmutable<Quaternion>): number {
View on GitHub (pinned to 0592b347b8)
Solutions
- Remove the call: component-wise max of quaternions is not a valid operation.
- For blending rotations use Quaternion.Slerp / Quaternion.SlerpToRef.
- If comparing orientations is the goal, compute the angular difference via Quaternion.Angle or Dot and select explicitly.
Example fix
// before const q = BABYLON.Quaternion.Maximize(q1, q2); // after const angle = BABYLON.Quaternion.Angle(q1, q2); // pick rotation explicitly const q = angle > 0 ? q1 : q2;
Defensive patterns
Strategy: validation
Validate before calling
if (typeof BABYLON.Quaternion.Maximize === 'function') {
throw new Error('Quaternion.Maximize is a forbidden placeholder; select rotations via Quaternion.Angle/Dot instead');
} Type guard
const isUsableQuaternionOp = (op: Function | undefined): op is Function => typeof op === 'function' && op !== (BABYLON.Quaternion as any).Maximize;
Try / catch
try {
result = (BABYLON.Quaternion as any).Maximize(q1, q2);
} catch (e) {
result = BABYLON.Quaternion.Angle(q1, q2) > 0 ? q1.clone() : q2.clone();
} Prevention
- Never call Quaternion.Maximize; it exists only for API parity and always throws.
- For orientation selection use Quaternion.Angle, Dot, or Slerp.
- Document in team guidelines that Minimize/Maximize are Vector3/Vector4-only.
When it happens
Trigger: Calling the static method Quaternion.Maximize() with any arguments; it never returns normally.
Common situations: Mechanically converting Vector3.Maximize calls to Quaternion; generic minimax code iterating over vector-like types; IDE autocomplete selecting the placeholder method.
Related errors
- Quaternion.Minimize does not make sense
- Atmosphere only supports one light source currently.
- Multi-file loading not allowed on env files.
- WebGPUComputeContext.getBindGroups: bindingsMapping is requi
- Cannot transform value ${a}
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/d187a391d91ce909.
Report an issue: GitHub.