AmmoJS Plugin - this.isSupported() is not a function

Hi there,

just working on a new project and trying to use AmmoJS.
Configuration is BabylonJS 4.2.0, AmmoJS included as an external CDN Script.

When I start to implement the plugin, i get an error in this area:

        this.bjsAMMO = {},
        this.name = "AmmoJSPlugin",
        this._timeStep = 1 / 60,
        this._fixedTimeStep = 1 / 60,
        this._maxSteps = 5,
        this._tmpQuaternion = new a.b,
        this._tmpContactCallbackResult = !1,
        this._tmpContactPoint = new a.e,
        this._tmpMatrix = new a.a,
        "function" == typeof t ? t(this.bjsAMMO) : this.bjsAMMO = t,
        this.isSupported() ? (this._collisionConfiguration = new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,
        this._dispatcher = new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),
        this._overlappingPairCache = i || new this.bjsAMMO.btDbvtBroadphase,

when I debug the lines, this.bjsAMMO for example is set correctly.
I don’t know, however, if “this” is set right. It has methods like “Vector3” “Vector4” and looks more like the BabylonJS object, not the plugin object.

Same for the CannonJS plugin, so i guess it’s a problem within the IPhysicsEnginePlugin. Can someone confirm (outside the playground)

Care to share the project? This seems very odd. How are you initializing/creating the physics plugin?

after Ammo().then() promise has been fulfilled, I initialize the plugin like in the example Using A Physics Engine | Babylon.js Documentation

scene.enablePhysics(null, BABYLON.AmmoJSPlugin());

and this line gets the error above

you are missing new before BABYLON

1 Like

holy …

sometimes, you have a tunnel vision. thanks a lot!

1 Like