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=''></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”

and I try another method

    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()) });

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

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

Hi @supsersuperman!

Maybe the code example below can help you.

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

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

1 Like