Game Development Reference
T HE R IGID -B ODY
P HYSICS E NGINE
spring forces and other force generators will work with this approach, but the
hard constraints we met in chapter 7 will not. We will look at collision detection in
the next part (part IV) of the topic, and then return to full 3D constraints in part V.
Even without hard constraints, there is still a lot we can do. This chapter looks at
two applications of physics that don't rely on hard constraints for their effects: boats
and aircraft. We'll build a flight simulator and a boat model. Adding the aerodynamics
from the flight simulator allows us to build a sailing simulation.
Our physics engine is now capable of simulating full rigid bodies in full 3D. The
O VERVIEW OF THE E NGINE
The rigid-body physics engine has two components:
1. The rigid bodies themselves keep track of their position, movement, and mass
characteristics. To set up a simulation we need to work out what rigid bodies are
needed and then set their initial position, orientation, and velocities (both linear
and angular). We also need to set their inverse mass and inverse inertia tensor.
The acceleration of an object due to gravity is also held in the rigid body. (This
could be removed and replaced by a force, if you so desire.)
2. The force generators are used to keep track of forces that apply over several frames
of the game.
We have removed the contact resolution system from the mass-aggregate system (it
will be reintroduced in parts IV and V).