80 Chapter 5 Adding General Forces
For forces that apply over an extended period of time, it would be better to hav e
some automated mechanism. We can make it easier to manage these long-term forces
by creating a registry . A force registers itself with a particle, and then will be asked to
provide a force each frame. I called these “force generators.”
5.2 Force Generators
We have a mechanism for applying multiple forces to an object. We now need to work
out where these forces come from. The force of gravity is fairly intuitive: it is always
present for all objects in the game.
Some forces arise because of the behavior of an object, such as a dedicated drag
force. Other forces are a consequence of the environment that an object finds itself
in; a buoyan ...