BabylonJS/Babylon.js · error

No Physics Plugin available.

Error message

No Physics Plugin available.

What it means

After validating the engine and its version, the constructor fetches the actual physics plugin via `physicsEngine.getPhysicsPlugin()`. If that returns null/undefined, the engine exists but has no usable plugin, so the constraint cannot be created.

Source

Thrown at packages/dev/core/src/Physics/v2/physicsConstraint.ts:58

     * @param scene The scene the constraint belongs to.
     *
     * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.
     * If all checks pass, it initializes the constraint with the given type and options.
     */
    constructor(type: PhysicsConstraintType, options: PhysicsConstraintParameters, scene: Scene) {
        if (!scene) {
            throw new Error("Missing scene parameter for constraint constructor.");
        }
        const physicsEngine = scene.getPhysicsEngine();
        if (!physicsEngine) {
            throw new Error("No Physics Engine available.");
        }
        if (physicsEngine.getPluginVersion() != 2) {
            throw new Error("Plugin version is incorrect. Expected version 2.");
        }
        const physicsPlugin = physicsEngine.getPhysicsPlugin();
        if (!physicsPlugin) {
            throw new Error("No Physics Plugin available.");
        }

        this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;
        this._options = options;
        this._type = type;
    }

    /**
     * Gets the type of the constraint.
     *
     * @returns The type of the constraint.
     *
     */
    public get type(): PhysicsConstraintType {
        return this._type;
    }

    /**

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Pass a valid plugin instance to `scene.enablePhysics(gravity, plugin)` so getPhysicsPlugin() returns it
  2. Check that plugin construction succeeded (e.g. Havok wasm initialized) before enabling physics
  3. Log `scene.getPhysicsEngine()?.getPhysicsPlugin()` to confirm it is set before creating constraints

Example fix

// before
scene.enablePhysics(gravity); // some paths create engine without plugin
const constraint = new PhysicsConstraint(type, options, scene); // throws
// after
const havok = await HavokPhysics();
scene.enablePhysics(gravity, new HavokPlugin(true, havok));
const constraint = new PhysicsConstraint(type, options, scene);
Defensive patterns

Strategy: validation

Validate before calling

const engine = scene.getPhysicsEngine();
if (!engine?.getPhysicsPlugin()) {
  throw new Error('Physics engine has no plugin; pass a plugin to scene.enablePhysics');
}

Type guard

function hasPhysicsPlugin(scene: BABYLON.Scene): boolean {
  return !!scene.getPhysicsEngine()?.getPhysicsPlugin();
}

Try / catch

try {
  const shape = new PhysicsShape(options, scene);
} catch (e) {
  if (e.message.includes('No Physics Plugin')) {
    // re-enable physics with an explicit plugin instance
  }
}

Prevention

When it happens

Trigger: `scene.getPhysicsEngine()` exists but `getPhysicsPlugin()` returns falsy — e.g. `new PhysicsEngine(gravity, undefined)` was constructed manually, or the plugin was never supplied to enablePhysics/engine constructor.

Common situations: Manually instantiating a PhysicsEngine without a plugin argument; a custom/partial physics integration that registers an engine but no plugin; plugin creation failed earlier and the failure was swallowed.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/bedb0075a1cafbab. Report an issue: GitHub.