Game Development Reference
In-Depth Information
5
A DDING G ENERAL
F ORCES
looked at the mathematics of forces in chapter 3, which let us simulate any force
we like by calculating the resulting acceleration.
In this chapter we will extend our physics engine so it can cope with multiple
different 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: code that can calculate forces based on the current state of the game world.
In part I we built a particle physics engine that included the force of gravity. We
5.1
D'A LEMBERT ' S P RINCIPLE
Although we have equations for the behavior of an object when a force is acting on
it, we haven't considered what happens when more than one force is acting. Clearly
the behavior is going to be different than if either force acts alone: one force could
be acting in the opposite direction to another, or reinforcing it in parallel. We need a
mechanism to work out the overall behavior as a result of all forces.
D'Alembert's principle comes to the rescue here. The principle itself is more com-
plex and far-reaching than we'll need to consider here. It relates quantities in a dif-
ferent formulation of the equations of motion. But it has two important implications
that we'll make use of in this topic. The first applies here; the second will arise in
chapter 10.
Search Nedrilad ::




Custom Search