I’d like to place a feature request, since, arguably its not really a bug but rather a missing setting.
The details are discussed with kdv’s input here: Physics collision margin
As far as the findings went, all collision primitives have a zero collision margin setting while mesh collision objects don’t.
Since it’s crucial for precise collision detection in most projects, I use geometry.setMargin(0) for mesh collision objects in puzzles.min.js (which gets lost when updating, obviously).
I think this could be generally set since all other collision objects have zero margins.
As an additional feature, setting the margin could be part of the physics “apply”-puzzle. I didn’t encounter any situation where I needed another setting than “0”, but others might need it.
I did actually encounter a situation where I needed non-zero collision margins lately:
Trying to stabilize a physics simulation with small objects (around 10cm / 0.1 BU) gaining some speed by falling, I had to modify (raise) the value for the margins. With a zero margin the mesh collision objects where passing right through the floor.
Considering this, it might be actually beneficial being able to set specific collision margins for physics objects (mesh and primitives).
The only thing that actually helped, was setting the collision margin in combination with applying high angular and linear damping to reduce the speed.
I do not know if this is a proven way of stabilizing physics collisions with ammo.js, but up to this point I haven’t found another solution – open to any suggestions, as usual.