Ammo.js performance optimization

Hi guys,

Is there a way to improve physics performance on scenes with multiple colliding dynamic bodies? I wonder if there is a way to improve performance by losing collision calculationg precision?
I am completely new to Ammo/Bullet, but I guess there should be something adjustable (like number of iterations during calculating collsions, decreasing of which will boost performance, but might cause some glitches). Am I right?

1 Like

PlayCanvas was just updated to support the very latest WASM build of ammo.js. Are you finding it to still be slow? It should now be far, far faster.

1 Like

You’re right, WASM build is around 50% faster, but it’s not enough. It’s very fast on desktops and top smartphones, but I still have performance troubles on low-spec devices.

1 Like

Well, I think it might be the devices slowing it down a bit.

Lol why not code a integration for the browser and send it to the borwsers developers so see what they’ll think or you can just suggest it lol

Can you provide some statistics about the number of active dynamic bodies you have in your scene? Is there a scene we can run to inspect exactly how you’re driving the physics engine?

Basically, it’s just a destructable tower built of blocks, 5x5x5 blocks in each dimension. Around 100-120 blocks in total.
These blocks are simple cubic shapes, and high precision to calculate the collisions isn’t required for that particular project. I’d rather focus on the performance.

After some research I found that changing pc.app.systems.rigidbody.maxSubSteps to lower values than default (which is 10) slightly increases physics performance; But it slows down the time on low-spec phones, it looks like the game runs in slow-mo.

1 Like