Game Development Reference
2. A force acting on an object produces acceleration that is proportional to the ob-
T HE F IRST L AW
The first law (Newton 1) tells us what happens if there are no forces around. The
object will continue to move with a constant velocity. In other words, the velocity of
the particle will never change, and its position will keep on being updated based on
the velocity. This may not be intuitive: moving objects we see in the real world will
slow and come to a stop eventually if they aren't being constantly forced along. In this
case the object is experiencing a force—the force of drag (or friction if it is sliding
along). In the real world we can't get away from forces acting on a body; the nearest
we can imagine is the movement of objects in space. What Newton 1 tells us is that if
we could remove all forces, then objects would continue to move at the same speed
In our physics engine we could simply assume that there are no forces at work
and use Newton 1 directly. To simulate drag we could add special drag forces. This is
fine for the simple engine we are building in this part of the topic, but it can cause
problems with more complex systems. The problem arises because the processor that
performs the physics calculations isn't completely accurate. This inaccuracy can lead
to objects getting faster of their own accord.
A better solution is to incorporate a rough approximation of drag directly into
the engine. This allows us to make sure objects aren't being accelerated by numerical
inaccuracy, and it can allow us to simulate some kinds of drag. If we need complicated
drag (such as aerodynamic drag in a flight simulator or racing game), we can still
do it the long way by creating a special drag force. We call the simple form of drag
“damping” to avoid confusion.
To support damping, we add another property to the particle class:
Excerpt from include/cyclone/particle.h
// ... Other Particle code as before ...
* Holds the amount of damping applied to linear
* motion. Damping is required to remove energy added
* through numerical instability in the integrator.
When we come to perform the integration, we will remove a proportion of the
object's velocity at each update. The damping parameter controls how velocity is left