Ammo.js bugs in stable and latest version of BJS

Hello, am trying to migrate one of my projects in either the stable version or the latest version of Babylonjs but I am encountering some ammo.js problems.

Version 4.0.3 - Whenever I run forceUpdate on a ammo.js physicsImpostor it gives an error.
Version 4.1.0-Alpha.7. When Creating a sphere physics impostor I get this error : TypeError: Ammo.btMultiSphereShape is not a constructor

Sorry If I am not being any more detailed or not having a playground repro. I am currently stuck on 4.0.0-alpha.21 which is the working version for me.

Did you make sure to use this file:

I have not, thanks for the heads up, I will try it and update you later on :slight_smile: .

It works with the preview version, however, I had a custom built ammo.js version because I needed the function clearforces of the rigid body. How can I compile it again and also be compatible with BJS?
Thanks in advance! :slight_smile:

I think @MackeyK24 did some work on compiling his own version of ammo

How are you loading Ammo on the page ?

    // ************************************************************************ //
    // DEFAULT LOADER - Initialize Default Scene Loading                        //
    // ************************************************************************ //
    window.addEventListener("DOMContentLoaded", function() {
        if (enablephysics === true && window.Ammo !== undefined) {
            Ammo().then(function() { defaultSceneLoader(scenepath, scenename); });
        } else {
            defaultSceneLoader(scenepath, scenename);
        }
    });

Try that

Thanks, Ammo loads fine though. I had to change it with the version in BJS repo as Deltakosh correctly pointed out.

The problem is that I use a custom built version of Ammo to make use of a function which does not come with the default Ammo build. My ammo version with the latest BJS does not work, how do I build it so that it can be compatible with BJS? Will the above code help somehow?

Referencing Maintaining Babylon Fork Of Ammo.js. If I build ammo with my function added in Ammo.idl with python make.py add_func command, will it be compatible with BJS?

Yes… Just adding items in Ammo.idl won’t break anything as far as Babylon.JS is concerned.

What functions are you adding… I added quite a few myself as well as a few Kinematic Character controller and raycast vehicle fixes so you may be able to use my full builds as well

Great - Thanks! I am adding clearforces of the rigidbody. I just need to reset the forces of a rigidbody and setting the velocities to 0 does not seem to do the trick. I think your full build should also be quite bigger than the normal one right?

My full build is about 2+ MB… About the same with add_func

In my code, I call forceUpdate on the physicsImpostors to reset the ball movement. I just figured out that the problem stands on the function physicsImpostor.forceUpdate Seems like for some reason, the impostor is not reset inthe latest version of BJS. The ball just never stops moving even though if I switch to my working BJS version it stops even with the latest ammo build so its not an ammo problem. I will just not change the BJS version for now.