Game Development Reference
In-Depth Information
Game Physics Artifacts
Dennis Gustafsson
Physics engines are known for being notoriously hard to debug. For most people,
physics artifacts are just a seemingly random stream of weird behavior that makes
no sense. Few components of a game engine cause much frustration and hair
loss. We have all seen ragdolls doing the funky monkey dance and stacks of
“rigid” bodies acting more like a tower of greasy mushrooms, eventually falling
over or taking off into the stratosphere. This chapter will help you understand the
underlying causes of this behavior and common mistakes that lead to it. Some of
them can be fixed, some of them can be worked around, and some of them we will
just have to live with for now. This is mostly written for people writing a physics
engine of their own, but understanding the underlying mechanisms is helpful even
if you are using an off-the-shelf product.
2.2 Discretization and Linearization
Physics engines advance time in discrete steps, typically about 17 ms for a 60 Hz
update frequency. It is not uncommon to split up the time step into smaller steps,
say two or three updates per frame (often called substepping) or even more, but no
matter how small of a time step you use, it will still be a discretization of a con-
tinuous problem. Real-world physics do not move in steps, not even small steps,
but in a continuous motion. This is by far the number one source for physics ar-
tifacts, and any properly implemented physics engine should behave better with
more substeps. If a physics artifact does not go away with more substeps, there
is most likely something wrong with your code. The bullet-through-paper prob-
lem illustrated in Figure 2.1 is a typical example of a problem that is caused by
Search Nedrilad ::

Custom Search