@sebavan and @Cedric … There has been build changes with ammo.js/kripken build system since the version of ammo.js in the 4.2 dist folder. (Built With Emscripten 1.39)
First the Emscripten build system has changed (Version 1.39 is the last version using older emscripten compilers)
Second the actual build system for the Bullet C++ src is now cmake. So all the switches have changed as well (or relocated to make files)
Third… the module setup is a bit different as well. Aa a matter of fact there is now a onload.js that is supposed to setup the the main Ammo object as a module
All this is a bit different than the ammo.js ( build with emscripten <= 1.39)
I initially had problem with the new system as well until kripken told me hold to build with the new system.
If there are issues with how or what ammo.js is doing on the playground, we need to find and address this (otherwise we are gonna be stuck with the older version of ammo.js built with the old emscripten compiler system that is in the 4.2 dist folder).
Now the main thing that is different from the version i built that is in the 4.2 dist folder (besides using the new build system itself) is the CLOSURE options is set to true. I never really used that before but when trying to figure out the new build system DCLOSURE=1 was one of the options that was given to me. So maybe the google closure cimpiler has something to do with it.
I can try and rebuild WITHOUT the closure.
But as far as i know … This is only way to build the CURRENT ammo.js using the CURRENT emscripten
To configure and build ammo into the builds directory, run the following:
$ cmake -B builds
$ cmake --build builds
There are also some key options that can be specified during cmake configuration, for example:
$ cmake -B builds -DCLOSURE=1 # compile with closure
$ cmake -B builds -DTOTAL_MEMORY=268435456 # allocate a 256MB heap
$ cmake -B builds -DALLOW_MEMORY_GROWTH=1 # enable a resizable heap
On windows, you can build using cmake's mingw generator:
> cmake -B builds -G 'MinGW Makefiles'
> cmake --build builds
Note that if you have not installed emscripten via the emsdk, you can configure its location with -DEMSCRIPTEN_ROOT.
Now i am using the these new builds (including the wasm version) in my toolkit and am driving around just fine… there are a few demos of my driving using these new ammo.js builds. Now i load my wasm a bit different than may be loading on the playground. But it works perfectly for me
var finalSceneLoadReady = function() {
// Ammo.js ready... can load scene here
}
var bulletPhysicsLoader = function() {
try {
if (typeof Ammo !== "undefined") {
Ammo().then(function() { finalSceneLoadReady(); });
} else {
finalSceneLoadReady();
}
} catch (ex4) {
console.error(ex4.message || "Unknown Bullet Exception");
}
}
I will continue to use the latest ammo.js (with new build system in Babylon Toolkit). But I would luv for the playground to have the same features of ammo.js that i am using in the Babylon Toolkit. Hopefully we can find the issue with the playground and new builds 
Anyways… How would i make a new build out and test on the playground ???