Ammo.js custom settings

So it seems like default Ammo settings aren’t precise enough which introduces various physics-related artifacts in the game I’m working on. I want to tinker with precision and solver settings, but where do I start?

Here are some initial Bullet docs I’ve come across:
http://bulletphysics.org/Bullet/BulletFull/annotated.html

Ammo initialization is PlayCanvas:

Definitely start by familiarizing yourself with the operation of Bullet:

The user manual is a good place to start.

Feel free to sync and build the engine. You can then even modify it and run your game against your custom build. You do this by adding ?use_local_engine=true to the URL of your game running from the Editor. You need to serve your engine build from http://localhost:51000

Thanks, Will!

But should I really build a custom engine for that? I’ve tried tinkering with the properties of pc.app.systems.rigidbody.dynamicsWorld, but it seems like not all functions got exported from Bullet C++ code.

Ultimately I’ve decided to spend some time and integrate Cannon.js, since it will give me more control over precision and solver settings. :+1:

1 Like

If you’re going to want to start modifying the internals of the engine, then yes, you’d really need to start building a custom version of it. It would be the only way to modify, say, the creation of the physics world.

You’re correct that our build of Ammo doesn’t include everything that is in Bullet. This was something decided on by the Ammo.js maintainer in order to reduce the footprint of the library.

By all means, integrate Cannon.js instead - that will definitely work. The only issue will be that you won’t get preview of collision primitives in the 3D view in the Editor. But you can always render them in the running game using a ‘debug mode’.