Collision of 2 physical bodies

Yes, you have to use a callback function. This function is called by the physics engine when a collision is detected. It doesn’t find collisions by itself. It’s the collision that triggers this functions to run.
Then, you can filter the collision infos and do your work. For example, if colObj0 or colIObj1 is a dynamite crate, then you can spawn a particle emitter and dispose the crate.

3 Likes

It simply registers a collision callback for each and every colliding pair in your physics world.
So the broadphase collects possible pairs of bodies based on overlapping AABBs. The narrowphase then checks whether these pairs do indeed collide, and if they do, resolves the collision using the iterative solver. So the callback function receives the reference to the manifold information(applied impulses, contacts points etc.) as well as the two bodies involved. This is the same way I apply custom actions to collisions.
So I think you can choose your own answer as a solution.

2 Likes