
5
Adding General
Forces
n Part I, we built a particle physics engine that included the force of gravity. We
Ilooked at the mathematics of forces in Chapter 3, which let us simulate any force
we liked by calculating the resulting acceleration.
In this chapter, we will extend our physics engine so it can cope with multiple dif-
ferent forces acting at the same time. We will assume that gravity is one force, although
this can be removed or set to zero if required. We will also look at force generators,
that is, code that can cal culate forces based on the curre nt state of the game world.
5.1 D’Alembert’s Principle
Although we have equations for the behav ...