Game Development Reference
In-Depth Information
6
S PRINGS AND
S PRINGLIKE
T HINGS
Although springs have an obvious use in driving games (for simulating the
suspension of a car), they come into their own in representing soft or deformable
objects of many kinds. Springs and particles alone can produce a whole range of im-
pressive effects such as ropes, flags, cloth garments, and water ripples. Along with the
hard constraints we'll cover in the next chapter, they can represent almost any kind of
object.
To extend our engine to support springs, this chapter will first cover the theory of
springs and then look at how they can be created for our engine. Finally we'll look at
a major problem in the simulation of springs.
One of the most useful forces we can create for our engine is a spring force.
6.1
H OOK ' S L AW
Hook's law gives us the mathematics of springs. Hook discovered that the force ex-
erted by a string depends only on the distance the spring is extended or compressed
from its rest position. A spring extended twice as far will exert twice the force. The
formula is therefore
f
=−
kl