Ammo out of memory

Hi, I’m with the same problem, but it is not working…

"failed to initialize module=Ammo error=wasm module aborted.

abort(“OOM”). Build with -s ASSERTIONS=1 for more info."

It looks like ammo is running out of memory (OOM). Not sure what could be causing that.

1 Like

yes, you are correct, but I still need to add the collision. Do exists a way of change the memory limit?

Your current setup has a collision mesh for every render component which there are ~700 so in total and using the the same mesh for collision as you are for the visual render mesh.

This means that you a VERY high resolution collision model. Even if you do increase the memory in Ammo (you have to compile your own version of Ammo for this GitHub - kripken/ammo.js: Direct port of the Bullet physics engine to JavaScript using Emscripten), this is not recommended.

Having such a high resolution mesh collision will decrease runtime performance as the physics engine has to check collision against many polys and it will also take a long time to load to generate the collision mesh at runtime.

It is recommended to use the primitives where possible, compound collisions or a much lower poly version of the model to use for collision.

1 Like

is there any guide for this? I’m not very experienced and some things are getting too complicated for me. I need to increasy the memory.

There isn’t a guide for this in terms of compiling Ammo to increase memory (you have to ask on their repo)

The simplest and recommended method is to create a low poly version of your model to use for the collision mesh.

I will try to reduce polyfaces on AutodeskMaya, but… isn’t it a problem? updade the “same” model 2 times? one for image and other for collisions?

I don’t know how detailed you need the collision to be but assuming this:

I would just remodel it from scratch because that would be much easier.

This leg for example:

It’s 12,000 triangles where the collision could be 12.

What problems are you thinking about?

To help with this, what do you need the collision for?

I want the collision to click object and display his name at 2D screen and to activate outline.
Remodel from scratch isn’t possible because this model was originally from Autodesk AutoCAD (format .DWG)

For this you should perhaps look at Picker, see example here:

That avoids the physics completely, assigns IDs to mesh instances, render those into a texture (invisible) and then reads from it to see what mesh it is.


When you say ‘click object’, do you mean the whole model or parts of it? In either case, you can just use primitive boxes and spheres.

You don’t have to use the original model to make one from scratch.

1 Like

these towers have small parts, and simple collisions like spheres and cubes would not allow me to have the precision I need

today latter I will try to use this collision, do you have the editor link?

Yaustar, do you have the editor link of this exemple?

Do you need to be pixel perfect? I would argue you can get pretty close approximation with primitives to select stuff with.

but wouldn’t it take a long time to position the collision boxes?

I can’t imagine it will take that long to resize and position. A couple of minutes for each one.

1 Like

I have to enable collisions and rename at least one part of the tower (like this one) per day. I need to make my life easier in terms of collisions.