
92 Chapter 6 Springs and Spring-Like Things
Spring
Camera
at fixed
height
FIGURE 6.1 The game’s camera attached to a spring.
6.2 Spring-Like Force Generators
We will implement four force generators that are based on spring forces. Although
each has a slightly different way of calculating the current length of the spring, they
all use Hook’s law to calculate the resulting force.
This section illustrates a feature of many physics systems. The core processing
engine remains generic, but it is surrounded by helper classes and functions (in this
case the different types of spring force generators) that are often quite similar to one
another. In the remainder ...