Issue with ammo.js in IoT web game game tutorial

Hi,
I am trying to replicate this tutorial on how to control an ESP8266 board with a BabylonJS-based app.
Create IOT Web Games with Babylon.js
YouTubedotcom: watch?v=CfcMtnAymR4

I get to the point where the target is rendered, but there is an error message related to the ammo.js library.

logger.ts:103 BJS - [09:35:12]: AmmoJS is not ready. Please make sure you await Ammo() before using the plugin.
e._LogEnabled @ logger.ts:103
logger.ts:103 BJS - [09:35:12]: Cannot read properties of undefined (reading 'setValue')
e._LogEnabled @ logger.ts:103

Has anyone run into a similar issue? How do i fix it?
I have the reference to Ammo.js added in the index.html as indicated in the tutorial.

 <script src="https://cdn.babylonjs.com/ammo.js"></script>

Thanks.

Please do not forget to add a link to a Playground to get a faster answer:

Looks like same issue as the one in this thread: Problem with Ammo.js

As @slin mentionned, copying the solution if somebody else arrives here.

As the message mentioned in the error, you need to initialize ammo before creating the plugin.

await Ammo(); or Ammo().then(() => { ... }

Unfortunately, this is the only way to stay uptodate with Ammo as they changed their initialization in their latest version.

2 Likes