Game Development Reference
Friction has not been taken care of yet. This means that unless we do something
more, particles will slide along the floor as if it were made of ice. According to the
Coulomb friction model, friction force depends on the size of the normal force be-
tween the objects in contact. To implement this, we measure the penetration depth
d p when a penetration has occurred (before projecting the penetration point out of
the obstacle). After projecting the particle onto the surface, the tangential velocity
v t is then reduced by an amount proportional to d p (the proportion factor being
the friction constant). This is done by appropriately modifying x ( t
Δ t ) (see
direction—in this case, it should simply be set to zero since this indicates that the
penetration point has ceased to move tangentially.
Figure 11.9. Collision handling with friction.
11.6.3 Collision Response
To prevent objects that are moving really fast from passing through other obstacles
(because of too-large time steps), a simple test is performed. Imagine the line
(or a capped cylinder of proper radius) beginning at the position of the object's
midpoint last frame and ending at the position of the object's midpoint at the
current frame. If this line hits anything, then the object position is set to the point
of collision. Though this can theoretically give problems, in practice it works fine.
Another collision “cheat” was used for dead bodies. If the unusual thing hap-
pens that a fast-moving limb ends up being placed with the ends of the capped
cylinder on each side of a wall, the cylinder is projected to the side of the wall
where the cylinder is connected to the torso.
The number of relaxation iterations used in Hitman varies between one and ten
with the kind of object simulated. Although this is not enough to accurately solve