BabylonJS/Babylon.js · error · ReferenceError
Quaternion.Minimize does not make sense
Error message
Quaternion.Minimize does not make sense
What it means
Quaternion.Minimize is a deliberately non-functional placeholder that always throws a ReferenceError. Quaternions represent rotations, so a component-wise minimum (as done for Vector3/Vector4 in Minimize) is mathematically meaningless for them. Babylon.js keeps the static method for API-shape parity with Vector3/Vector4 but forbids its use.
Source
Thrown at packages/dev/core/src/Maths/math.vector.pure.ts:6072
}
/**
* Sets a Quaternion with random values between min and max
* @param min the minimum random value
* @param max the maximum random value
* @param ref the ref to store the values in
* @returns the ref with random values between min and max
*/
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));
View on GitHub (pinned to 0592b347b8)
Solutions
- Remove the call: there is no valid 'minimum quaternion' operation.
- If you need to interpolate between rotations, use Quaternion.Slerp or Quaternion.SlerpToRef instead.
- If you meant component-wise min, operate on Vector4s or extract components and compare manually after converting to a comparable representation (e.g. angle).
Example fix
// before const q = BABYLON.Quaternion.Minimize(q1, q2); // after const q = new BABYLON.Quaternion(); BABYLON.Quaternion.SlerpToRef(q1, q2, t, q);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof BABYLON.Quaternion.Minimize === 'function') {
throw new Error('Quaternion.Minimize is a forbidden placeholder; use Slerp for rotation blending');
} Type guard
const isUsableQuaternionOp = (op: Function | undefined): op is Function => typeof op === 'function' && op !== (BABYLON.Quaternion as any).Minimize;
Try / catch
try {
result = (BABYLON.Quaternion as any).Minimize(q1, q2);
} catch (e) {
result = new BABYLON.Quaternion();
BABYLON.Quaternion.SlerpToRef(q1, q2, 0.5, result);
} Prevention
- Never call Quaternion.Minimize/Maximize; treat them as deleted API.
- Use Slerp/Nlerp/Quaternion.Angle for comparing or blending rotations.
- Add a lint rule banning Quaternion.Minimize and Quaternion.Maximize.
When it happens
Trigger: Calling the static method Quaternion.Minimize() with any arguments; there is no code path that ever returns normally.
Common situations: Copy-pasting Vector3.Minimize-style code and swapping the class to Quaternion; generic numeric code that calls Minimize/Maximize uniformly across vector-like types; migrating code from another math library.
Related errors
- Quaternion.Maximize 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/c24abc68b8bb10b9.
Report an issue: GitHub.