is it possible to spawn objects in the same location, but make their bodies not join together?
Basically i have a bunch of b2bodies that i spawn at a given time, and i need them to bounce off each other rather than stick to each other..
So this would create a sort of explosion of the created bodies because they repel against each
other.
Anyone have any ideas?
Is this possible with box2d?
Based from my experience, dynamic bodies with single fixtures would immediately repel each other the moment their physics simulation steps begin. Bodies with multiple fixtures would have problems if their fixtures crisscross each other because they would stick together.
I’m not sure if you can get explosion this way, because the repulsion force is usually weak. What you can do is to set up a contact listener that would detect contacts and apply opposing forces to bodies that are touching during spawning. Or maybe you can do AABB query before spawning a body to check if there is already a body at the spawn location, and apply the forces to the bodies.