9
Introducing Dynamics Simulation 711
are simulation steps only. This was achieved by
instructing the physics engine to employ four
substepsperkey.Thus,foreachfoursimulation
stepswecreateonlykeyframe. Bysettingthe
number of substeps we can control the accuracy
of the physical simulation independent of the
number of keyframes created.
Rigid Bodies and Deformable Bodies
Rigid B odies
Havok simulates most objects in a simulation
as rigid bodies.Arigidbodyisanobjectwhose
geometry doesn’t change over the course of the
simulation. You can simulate any real-world object
that do esn’t noticeably change its shape, from a
pentoaboulderhurtlingdownamountainside,
as a rigid b ody. Simulating objects in this way
facilitates r apid physical simulation in real time;
the physics engine can make cer tain assumptions
when detecting collisions based on the fact that
the objects ’ shapes don’t vary from simulation step
to simulation step.
Both the Havok 1 and Havok 3 engines can
simulate rig id bo dies, but Havok 3 simulations are
faster and more accurate.
Deformable Bodies
To s i mu l ate cloth, rop e, or ot he r m ater i a l w hose
shape changes over time, you n eed to use a
different typ e of body: a deformable body. With
deformable objects, collision detection becomes
much more difficult, given that t he object can
change shape dramatically between time steps
and can a lso attempt to collide w ith itself. For this
reason, deformable bodies are more expensive to
simulate.
Note: OnlytheHavok1enginecansimulatewith
deformable bodies.
Scale
Our scientific knowledge of physics is extensive.
What we are concerned with here would more
accurately be described as a mechanical simulation
of the interactions of objects at real-world scales.
We are dealing with Newtonian mechanics; that is,
the well-understood laws of motion, popularized
by Sir Isaac Newton, that describe the behavior
of objects under the influences of other objects
and external forces. Since then we’ve discovered
that these laws break dow n at very small (i.e.
subatomic) and very large (i.e. planetary ) scales.
New physics systems have been devised to work
with these sca les ( for example, relativistic and
quantum), but these are beyond the scope of
the reactor physics engine. The Havok physics
simulation technology works at the scale of objects
we interact with on a daily basis, such as chairs,
cars, buildings, and footballs. By default, the
engine works in units of meters and kilograms.
It’s important to keep in mind the scale in which
yo u’re working. For example, a common mistake
people make is to start by creating a cube 100
meters on a side, and then they wonder why it
takessolongtofall.Aboxofthissizewhenviewed
atadistancesufficienttobeabletoseetheentire
box (say 1km away) w ill appear to fall at the same
speed as an aircraft hangar dropped from a height
andviewedfromakilometeraway:slowly.
Changing Scale
TheHavokphysicsenginedoesnotcarewhat
units of measurement you use when specifying
the size of objects or the strength of gravity ; it
cares only about the numbers. So you could, for
instance, work in inches. However, for realistic (or
at least predictable) results, it’s important to be
consistent. So, for instance, if you’re working in
meters,makesuregravityissettoanappropriate
valueinmeters.ToproduceEarth-likegravity,use