Game Development Reference
In-Depth Information
that for very light objects with relatively large volumes, the buoyant forces in air may
be significant. For example, consider simulating a large balloon.
Springs and Dampers
Springs are structural elements that, when connected between two objects, apply equal
and opposite forces to each object. This spring force follows Hooke's law and is a func‐
tion of the stretched or compressed length of the spring relative to the rest length of the
spring and the spring constant of the spring. Hooke's law states that the amount of stretch
or compression is directly proportional to the force being applied. The spring constant
is a quantity that relates the force exerted by the spring to its deflection:
F s = k s (L - r)
Here, F s is the spring force, k s is the spring constant, L is the stretched or compressed
length of the spring, and r is the rest length of the spring. In the metric system of units,
F s would be measured in newtons (1 N = 1 kg-m/s 2 ), L and r in meters, and k s in kg/s 2 .
If the spring is connected between two objects, it exerts a force of F s on one object and
- F s on the other; these are equal and opposite forces.
Dampers are usually used in conjunction with springs in numerical simulations. They
act like viscous drag in that they act against velocity. In this case, if the damper is con‐
nected between two objects that are moving toward or away from each other, the damper
acts to slow the relative velocity between the two objects. The force developed by a
damper is proportional to the relative velocity of the connected objects and a damping
constant, k d , that relates relative velocity to damping force.
F d = k d (v 1 - v 2 )
This equation shows the damping force, F d , as a function of the damping constant and
the relative velocity of the connected points on the two connected bodies. In metric
units, where the damping force is measured in newtons and velocity in m/s, k d has units
of kg/s.
Typically, springs and dampers are combined into a single spring-damper element,
where a single formula represents the combined force. Using vector notation, we can
write the formula for a spring-damper element connecting two bodies as follows:
F 1 = -{k s (L - r) + k d (( v 1 - v 2 ) • L )/L} L /L
Here, F 1 is the force exerted on body 1, while the force, F 2 , exerted on body 2 is:
F 2 = - F 1