{"record":{"id":"1d24e1b03793a26c","repo":"BabylonJS/Babylon.js","slug":"unsupported-constraint-type","errorCode":null,"errorMessage":"Unsupported Constraint Type.","messagePattern":"Unsupported Constraint Type\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Physics/v2/Plugins/havokPlugin.ts","lineNumber":2265,"sourceCode":"                    if (l.minLimit != undefined) {\r\n                        this._hknp.HP_Constraint_SetAxisMode(jointId, axId, this._hknp.ConstraintAxisLimitMode.LIMITED);\r\n                        this._hknp.HP_Constraint_SetAxisMinLimit(jointId, axId, l.minLimit);\r\n                    }\r\n\r\n                    if (l.maxLimit != undefined) {\r\n                        this._hknp.HP_Constraint_SetAxisMode(jointId, axId, this._hknp.ConstraintAxisLimitMode.LIMITED);\r\n                        this._hknp.HP_Constraint_SetAxisMaxLimit(jointId, axId, l.maxLimit);\r\n                    }\r\n                }\r\n                if (l.stiffness) {\r\n                    this._hknp.HP_Constraint_SetAxisStiffness(jointId, axId, l.stiffness);\r\n                }\r\n                if (l.damping) {\r\n                    this._hknp.HP_Constraint_SetAxisDamping(jointId, axId, l.damping);\r\n                }\r\n            }\r\n        } else {\r\n            throw new Error(\"Unsupported Constraint Type.\");\r\n        }\r\n\r\n        const collisionEnabled = !!options.collision;\r\n        this._hknp.HP_Constraint_SetCollisionsEnabled(jointId, collisionEnabled);\r\n        this._hknp.HP_Constraint_SetEnabled(jointId, true);\r\n    }\r\n\r\n    /**\r\n     * Get a list of all the pairs of bodies that are connected by this constraint.\r\n     * @param constraint the constraint to search from\r\n     * @returns a list of parent, child pairs\r\n     */\r\n    getBodiesUsingConstraint(constraint: PhysicsConstraint): ConstrainedBodyPair[] {\r\n        const pairs: ConstrainedBodyPair[] = [];\r\n        for (const jointId of constraint._pluginData) {\r\n            const bodyIds = this._constraintToBodyIdPair.get(jointId[0]);\r\n            if (bodyIds) {\r\n                const parentBodyInfo = this._bodies.get(bodyIds[0]);\r","sourceCodeStart":2247,"sourceCodeEnd":2283,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Physics/v2/Plugins/havokPlugin.ts#L2247-L2283","documentation":"HavokPlugin supports a fixed set of joint types (ball and socket, hinge, prismatic, slider, fixed, six dof). When building a constraint it switches on PhysicsConstraintType; any other value has no corresponding Havok joint and reaches the else throw. The constraint is never created or enabled in that case.","triggerScenarios":"new PhysicsConstraint(PhysicsConstraintType.LOCK, params, scene) or passing an invalid/undefined constraint type, so the joint-creation switch in HavokPlugin falls through to the throw at havokPlugin.ts:2265.","commonSituations":"Using a constraint type that exists in the Babylon enum but is not mapped for Havok; passing a numeric type from old code written for the v1 physics API; typos or custom numbers cast to PhysicsConstraintType.","solutions":["Use one of the mapped types: BALL_AND_SOCKET, HINGE, PRISMATIC, SLIDER, FIXED, SIX_DOF (via Physics6DoFConstraint).","Replace unsupported types with the closest supported joint (e.g. LOCK/FIX behaviors via SIX_DOF limits).","Verify the type value is the imported enum member and not a stale numeric constant from the v1 API."],"exampleFix":"// before\nconst c = new PhysicsConstraint(PhysicsConstraintType.LOCK, params, scene);\n// after\nconst c = new PhysicsConstraint(PhysicsConstraintType.FIXED, params, scene);","handlingStrategy":"validation","validationCode":"const SUPPORTED = [PhysicsConstraintType.BALL_AND_SOCKET, PhysicsConstraintType.HINGE, PhysicsConstraintType.PRISMATIC, PhysicsConstraintType.SLIDER, PhysicsConstraintType.FIXED];\nif (!SUPPORTED.includes(type)) {\n  throw new Error(`unsupported constraint type for Havok: ${type}; use SIX_DOF via Physics6DoFConstraint for complex joints`);\n}","typeGuard":"function isSupportedConstraintType(t: unknown): t is PhysicsConstraintType {\n  return [PhysicsConstraintType.BALL_AND_SOCKET, PhysicsConstraintType.HINGE, PhysicsConstraintType.PRISMATIC, PhysicsConstraintType.SLIDER, PhysicsConstraintType.FIXED].includes(t as PhysicsConstraintType);\n}","tryCatchPattern":null,"preventionTips":["Restrict constraint creation to the six Havok-mapped joint types.","Model LOCK-style behavior with Physics6DoFConstraint (SIX_DOF) limits instead of unsupported types.","Do not carry numeric constraint constants over from the v1 physics API."],"tags":["physics","havok","constraint","unsupported"],"backgroundTag":"unsupported-constraint-type","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}