656 12. Collision and Rigid Body Dynamics
spurious contacts because it will think that the object is about to hit the edge
of the next triangle. This is illustrated in Figure 12.29.
There are a number of solutions to this problem. One is to analyze the
set of contacts and discard ones that appear to be spurious, based on various
heuristics and possibly some knowledge of the object’s contacts on a previous
frame (e.g., if we know the object was sliding along a surface and a contact
normal arises that is due to the object being near the edge of its current tri-
angle, then discard that contact normal). Versions of Havok prior to 4.5 em-
ployed this approach.
Starting with Havok 4.5, a new technique was implemented that essen-
tially annotates the mesh with triangle adjacency information. The collision
detection system therefore “knows” which edges are interior edges and can
discard spurious collisions reliably and quickly. Havok describes this solution
as welding , because in eff ect the edges of the triangles in the poly soup are
welded to one another.
12.4.7.7. Coming to Rest, Islands, and Sleeping
When energy is removed from a simulated system via friction, damping, or
other means, moving objects will eventually come to rest. This seems like a
natural consequence of the simulation—something that would just “fall out”
of the diff erential equations of motion. Unfortunately, in a real computerized
simulation, coming to rest is never quite that simple. Various factors such as
fl oating-point error, inaccuracies in the calculation of restitution forces, and
numerical instability can cause objects to jitt er forever rather than coming to
rest as they should. For this reason, most physics engines use various heuris-
tic methods to detect when objects are oscillating instead of coming to rest
as they should. Additional energy can be removed from the system to en-
sure that such objects eventually sett le down, or they can simply be stopped
abruptly once their average velocity drops below a threshold.
Figure 12.29. When an object slides between two adjacent triangles, spurious contacts with
the new triangle’s edge can be generated.
Spurious Contac ts
with Triangle Edge