Game Development Reference
Figure 2.8. Fast-moving objects could potentially get rotated through the floor even if a
contact is generated.
There is also a fairly common case that is a combination of the two. Imagine
a thin rod, slightly inclined, falling onto a flat surface, as illustrated in Figure 2.8.
The initial impact on the left side can cause a rotation so severe that by the next
time step, more than half of the rod has already passed through the floor, and con-
tact generation pushes it out on the other side. This example is a good illustration
of the sometimes complex interaction between linearization and discretization
that can bring a seemingly simple case like this to epic failure, even with con-
tinuous collision detection switched on. Note that some physics engine actually
do have a really sophisticated nonlinear continuous collision detection that does
consider rotation as well, in which case the example mentioned above would have
Sandwich case. The sandwich case can be somewhat worked around by priori-
tizing contacts. It is always the last constraints in a sequential impulse solver that
will be the most powerful and less prone to be violated upon early termination.
Therefore, it is best to rearrange the stream of contacts so that the ones that touch
important game-play mechanisms, such as walls, are solved at the very last. A
good common practice to avoid having objects get pushed through walls or the
floor is to solve all contacts involving a static object after any other contact or do
an extra iteration or two after termination to satisfy only static contacts.
Bullet-through-paper. An engine that aims to solve only the bullet-through-
paper case typically uses a raycast or linear sweep operation to find a time of
impact, then either splits up the time step—simulates the first half until the ob-
ject is touching and then does the rest—or employs an early-engage method that
inserts a contact point before the object has actually reached the surface. The
early-engage method can sometimes be noticed as an invisible wall in front of
obstacles, especially when using zero restitution, in which case a falling object
could come to a full stop some distance above the floor before finally falling the