Ammo.js How to reset/disable impact impulse for one entity during collision between two dynamic rigid bodies

Hi,

I am using ammo.js. All entities have a rigidbody of type DYNAMIC and a collision component. The entities are divided into two groups. I need to detect collisions between all entities, but if a collision occurs between an entity from the first group and an entity from the second group, I need the entity from the second group not to receive the impact impulse (essentially, I need the entity from the second group to behave as if it had a rigidbody of type STATIC or KINEMATIC in this situation).

I tried resetting the entity’s linear and angular velocity in response to the COLLISION_START event or keeping the entity in its original position using rigidbody.teleport(), but even so, the entity still receives an impulse after the collision, which also affects nearby entities, and I don’t know how to avoid the application of this impulse.

Another idea that came to my mind is to use rigidbody.mask and rigidbody.group to prevent collision detection between entities from the first and the second group. I could add a child entity with a collision component (without a rigidbody) to each entity and detect the TRIGGER_ENTER event. However, in that case, I would have to manually calculate the impact impulse for the the entity from the first group somehow.

This is similar to Avoid collision b/w two rigidbodies