
14.4 The Collision Resolution Pr ocess 379
// dealing with the second body in a contact,
// and negative otherwise (because we’re
// subtracting the resolution).
c[i].penetration +=
deltaPosition.scalarProduct
(c[i].contactNormal)
* (b?1:-1);
}
}
}
}
positionIterationsUsed++;
}
}
14.4.4 Resolving Velocity
With penetration resolved we can turn our attention to velocit y. This is the point
at which different physics engines vary the most, with several different but excellent
strategies for res olving velocity. We’ll return to some of them in Chapter 20.
For this chapter, I have aimed for the simplest end of the spectrum: a velocity
resolution system that works