Game Development Reference
In-Depth Information
/ /
/ /
Temporary
/
working
v a r i a b l e s
/ /
/ /
F o r c e
a c c u m u l a t o r s .
C l e a r e d
t o
z e r o
each
t i m e
s t e p
V e c t o r 3
f o r c e ;
V e c t o r 3
t o r q u e ;
V e c t o r 3
l i n I m p u l s e ;
V e c t o r 3
a n g I m p u l s e ;
/ /
/ /
C o l l i s i o n
and
c o n s t r a i n t
l i s t s
/ /
v e c t o r < U s e r C o n s t r a i n t ∗> u s e r C o n s t r a i n t s ;
v e c t o r < C o l l i s i o n S h a p e ∗> c o l l i s i o n S h a p e s ;
} ;
Listing 12.2
Dynamics body state variables
Collision Geometry. If the dynamics body is the soul of a rigid object, the
collision geometry is its earthly manifestation. The collision geometry is
used to define the shape of dynamics bodies, and also of other “soulless” or
static objects. Typically, a physics engine will support a number of different
primitives. In order of complexity, these are
basic abstract primitives such as spheres, boxes, planes, cylinders,
cones, and the like;
convex polyhedra;
arbitrary collision mesh, sometimes called a “triangle soup.”
The simpler shapes have advantages in both speed and stability, which
is why it's often best to build up a concave or complicated shape from
multiple primitives. These primitives are allowed to penetrate each other;
only their union matters, since two geometry objects attached to the same
dynamics body will not collide with each other. Indeed, it's important for
the physics engine to provide flexibility in deciding which pairs of geometry
objects collide; for example, on a character, the thigh part might not collide
with the connected torso and shin parts, but it might collide against every
other part in the body. Or, under the auspices of the first law of video
game physics, we might create a barrier that enemies can pass through but
the player character cannot.
A collision geometry object either will be associated with a single dy-
namics body, to which it has a fixed relative position and orientation, or
will not be associated with any dynamics body and is part of the static
“world.”
Search WWH ::




Custom Search