Game Development Reference
F IGURE 7.2
Two objects are interpenetrating if they are partially embedded in each other, as
shown in figure 7.2. When we're processing a collision between partially embedded
objects, it is not enough to only change their velocity. If the objects are colliding with
a small coefficient of restitution, their separation velocity might be almost zero. In
this case they will never move apart, and the player will see the objects stuck together
in an impossible way.
As part of resolving the collisions, we need to resolve the interpenetration.
R ESOLVING I NTERPENETRATION
When two objects are interpenetrating, we move them apart just enough to separate
them. We expect the collision detector to tell us how far the objects have interpen-
etrated, as part of the Contact data structure it creates. The calculation of the inter-
penetration depth depends on the geometries of the objects colliding, and as we saw
earlier, this is the domain of the collision detection system rather than the physics
We add a data member to the Contact data structure to hold this information:
Excerpt from include/cyclone/pcontacts.h
// ... Other ParticleContact code as before ...
* Holds the depth of penetration at the contact.