2009

Substeps
In the previous section, we said that the physics engine passes on the necessary
information to update the display after it determines the new positions for
all its objects. However, what if you don't want to update the display in each
simulation time step?
Let's say we absolutely need to update the application once every 1/60th of a
second, either because we're playing a real-time game that refreshes the screen
at 60Hz. or we're creating a keyframe every frame for a 60FPS movie. This
effectively means that we want to step the physics engine at intervals of 1/60th
of a second. In many cases this does not present a problem, but if,
hypothetically, the accuracy of the simulation was not sufficient (remember:
smaller time steps mean better accuracy), then wed like to decrease the time
step even further, say to 1/120th of a second. But this would mean we generate
twice the number of images/keyframes we are interested in, which is wasteful.
To get around this, the Havok engine allows you to specify the number of
substeps to take per key.
The Substeps/Key parameter specifies the number of steps the physics engine
takes before updating the application. This gives control over the granularity
of the physics simulation independent of the display update or
keyframe-creation frequency. So with Substeps/Key=1, reactor uses a single
simulation step for each update to the 3D display. With Substeps/Key=2,
reactor takes two physics steps each time before updating the application, and
so on.
3894 | Chapter 16 reactor