Game Development Reference
In-Depth Information
Equation (12.32) assumes that all vectors are measured in the same co-
ordinate space and that the inverse inertia tensors operate on vectors in
that same space. However, the inverse inertia tensor is a constant only in
body space, and the same matrix in world space may not be updated con-
tinually as the object rotates. Our convention is to describe the orientation
of the object by using R , a rotation matrix that transforms row vectors
on the left from body space to upright space. Under these assumptions, in
Equation (12.32) we would replace J
−1 with R T J
−1 R .
12.6
Real-Time Rigid Body Simulators
This section presents an overview of real-time rigid body simulators such
as PhysX, Havok, Bullet Physics, and the Open Dynamics Engine. Few
game programmers will work directly on the physics engine, and certainly
far fewer will write one from scratch. Most of us just need to know how
to use the thing. Luckily, in this regard the physics engines previously
listed have much in common. However, a physics engine is like many other
programming tools: even if you don't intend to write one, you can use it
more effectively if you have a basic understanding of how things work under
the hood.
We regret that we won't be able to go into great detail, for a few reasons.
First, any attempt to describe “how a physics engine works” is complicated
by the fact that currently there is still great diversity and rapid innovation
in the field. Second, the math quickly becomes more advanced than is
appropriate for this introductory book. Frankly, your authors simply do
not have enough expertise to succinctly summarize the state of the art
from top to bottom. However, from a user's perspective, there are many
similarities between physics engines that can be covered in an introductory
manner, so we start with an overview of a typical physics engine interface.
There are also a few choice mathematics that are discussed near the end of
this chapter.
12.6.1
Physics Engine State Variables
An old computer science adage attributed to Fred Brooks says, “Show
me your flow charts and conceal your tables, and I shall continue to be
mystified. Show me your tables, and I won't usually need your flowcharts;
they'll be obvious.” Despite the image of a banner printed on Z-fold paper
using The Print Shop that is evoked by the arcane terminology, the essence
of the message is still true today: to write or understand software, a good
place to start is a description of the data that are being operated on. From
the perspective of the user of a physics engine, there are three main types of
 
Search WWH ::




Custom Search