How to load ammo.js in simple way

Hello, I would to create a game using just the playcanvas-stable.min.js as index.html and load it into my browser like

super-simple Hello World example - a spinning cube!

I don’t know how to load ammo.js into index.html.
I tried adding both ammo.js but that did not work.

<script src='https://code.playcanvas.com/playcanvas-stable.min.js'></script>
 <script src='ammo/ammo.wasm.js'></script>
 <script src='ammo/ammo.wasm.wasm'></script>
<script src='ammo/ammo.js'></script>

it displays “TypeError: Ammo.btCompoundShape is not a constructor”
message

and I try another method

 <script>
    var ammoPath = "ammo/"
    pc.WasmModule.setConfig('Ammo', {
    glueUrl:       'ammo/ammo.wasm.js',
    wasmUrl:     'ammo/ammo.wasm.wasm',
     fallbackUrl: 'ammo/ammo.js'
    });
    new Promise((resolve) => { pc.WasmModule.getInstance('Ammo', () => resolve()) });
   .....
   app.start();
</script>

it displays “Uncaught TypeError: Cannot read properties of undefined (reading ‘setValue’)”
message

Any idea??
Thank you for your attention to this matter.

Hi @supsersuperman!

Maybe the code example below can help you.

https://playcanvas.github.io/#/physics/falling-shapes

@supsersuperman Have you thought about using the engine like this instead:

I’d say this is a more ‘modern’ approach.

1 Like