Game Engine Architecture

(Ben Green) #1

630 12. Collision and Rigid Body Dynamics


12.3.8.3. Game-Specifi c Collision Materials
Game developers oft en need to categorize the collidable objects in the game
world, in part to control how they collide (as with collision fi ltering) and in
part to control other secondary eff ects, such as the sound that is made or the
particle eff ect that is generated when one type of object hits another. For ex-
ample, we might want to diff erentiate between wood, stone, metal, mud, wa-
ter, and human fl esh.
To accomplish this, many games implement a collision shape categoriza-
tion mechanism similar in many respects to the material system used in the
rendering engine. In fact, some game teams use the term collision material to
describe this categorization. The basic idea is to associate with each collid-
able surface a set of properties that defi nes how that particular surface should
behave from a physical and collision standpoint. Collision properties can in-
clude sound and particle eff ects, physical properties like coeffi cient of restitu-
tion or friction coeffi cients, collision fi ltering information, and whatever other
information the game might require.
For simple convex primitives, the collision properties are usually associ-
ated with the shape as a whole. For poly soup shapes, the properties might be
specifi ed on a per-triangle basis. Because of this latt er usage, we usually try
to keep the binding between the collision primitive and its collision material
as compact as possible. A typical approach is to bind collision primitives to
collision materials via an 8-, 16-, or 32-bit integer. This integer indexes into
a global array of data structures containing the detailed collision properties
themselves.

12.4 Rigid Body Dynamics


Many game engines include a physics system for the purposes of simulating the
motion of the objects in the virtual game world in a somewhat physically real-
istic way. Technically speaking, game physics engines are typically concerned
with a particular fi eld of physics known as mechanics. This is the study of how
forces aff ect the behavior of objects. In a game engine, we are particularly
concerned with the dynamics of objects—how they move over time. Until very
recently, game physics systems have been focused almost exclusively on a
specifi c subdiscipline of mechanics known as classical rigid body dynamics. This
name implies that in a game’s physics simulation, two important simplifying
assumptions are made:
z Classical (Newtonian) mechanics. The objects in the simulation are as-
sumed to obey Newton’s laws of motion. The objects are large enough
Free download pdf