BabylonJS/Babylon.js · error

No Physics Plugin available.

Error message

No Physics Plugin available.

What it means

After version validation, PhysicsShape fetches the plugin with `physicsEngine.getPhysicsPlugin()`; a falsy result means the engine object exists but carries no plugin, so no plugin-side shape data can be created and the constructor throws.

Source

Thrown at packages/dev/core/src/Physics/v2/physicsShape.ts:79

     *
     * This code is useful for creating a new physics shape with the given type, options, and scene.
     * It also checks that the physics engine and plugin version are correct.
     * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.
     */
    constructor(options: PhysicShapeOptions, scene: Scene) {
        if (!scene) {
            return;
        }
        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;

        if (options.pluginData !== undefined && options.pluginData !== null) {
            this._pluginData = options.pluginData;
            this._type = this._physicsPlugin.getShapeType(this);
        } else if (options.type !== undefined && options.type !== null) {
            this._type = options.type;
            const parameters = options.parameters ?? {};
            this._physicsPlugin.initShape(this, options.type, parameters);
        }
    }

    /**
     * Returns the string "PhysicsShape".
     * @returns "PhysicsShape"
     */
    public getClassName() {

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Always pass a concrete plugin to `scene.enablePhysics(gravity, plugin)`
  2. Verify plugin initialization (e.g. Havok wasm) resolved before enabling physics
  3. Assert `scene.getPhysicsEngine()?.getPhysicsPlugin()` is truthy in bootstrapping code

Example fix

// before
scene.enablePhysics(gravity); // no plugin
const shape = new PhysicsShape(options, scene); // throws
// after
const havok = await HavokPhysics();
scene.enablePhysics(gravity, new HavokPlugin(true, havok));
const shape = new PhysicsShape(options, scene);
Defensive patterns

Strategy: validation

Validate before calling

if (!scene.getPhysicsEngine()?.getPhysicsPlugin()) {
  throw new Error('A registered physics plugin is required before creating a PhysicsShape');
}

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
  }
}

Prevention

When it happens

Trigger: Scene has a PhysicsEngine instance but no plugin registered — e.g. engine constructed without a plugin argument, or plugin assignment failed/was skipped during custom integration.

Common situations: Custom physics engine subclasses created without a plugin; failed async plugin initialization silently leaving the engine plugin-less; manually calling `new PhysicsEngine(gravity)` then attaching it to the scene.

Related errors


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