The Laws of Motion

Game development community call point masses with particles.

The Particle

A particle has a position, but no orientation. In other words, we can’t tell what direction a particle is pointing: it either doesn’t matter or it doesn’t make sense.

The First Two Laws

There are three laws of motion put forward by Newton; The first two laws of motion follow:

  1. An object continues with a constant velocity unless a force acts upon it.
  2. A force acting on an object produces acceleration that is proportional to the object’s mass.

The First Law

The first law tells us what happens if there are no forces around. The object will continue to move with a constant velocity. In the real world, we can’t get away from forces acting on a body; the closest phenomenon that we can imagine is the movement of objects in space.

In a 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, but 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. If we need complicated drag (such as aerodynamic drag in a flight simulator or racing game) we can still dot hat the long way, by creating a special drag force.

The Second Law

The second law tells us how forces alter the motion of an object. A force is something that changes the acceleration of an object (i.e., the rate of change of velocity).

The Force Equations

The formula relating the force to the acceleration is the famous


The vector form of that is given by


Adding Mass to Particles

It is often useful, however, to simulate infinite masses. These are objects that no force of any magnitude can move. They might be just as physically impossible, but they are very useful for immovable objects in a game: the walls or floor, for example, cannot be moved. If we feed an infinite mass into the force equation, then the acceleration will be zero, as we want. As long as such an object has zero initial velocity, it will always stay in the same place.

Unfortunately, we cannot represent a true infinity in most computer languages, and the optimized mathematics instructions on all common game processors do not cope well with infinities.

Note that in last equation we use 1 over the mass to calculate our acceleration. we can speed up our calculations by storing 1 over the mass. We call this the inverse mass. This solves our problem for representing objects of zero or infinite mass: infinite mass objects have a zero inverse mass, which is easy to set. Objects of zero mass would have an infinite inverse mass,which cannot be specified in most programming languages.

Momentum and Velocity

Momentum is the product of velocity and mass. Since mass is normally constant, we can assume that velocity is therefore constant by Newton-1. In the event that a traveling object is changing mass, then its velocity would also be changing, even with no force.

This will be an important distinction when we consider rotations later, however, because rotating objects can change the way their mass is distributed. Under the rotational form of Newton-1, that means a change in rotational speed with no other forces acting.

The Force of Gravity

The formula Newton developed is called the law of universal gravitation:


where m1 and m2 are the masses of the two objects, r is the distance between their centers, f is the resulting force, and G is the “universal gravitational constant,” a scaling factor derived from observation of planetary motion.

Because we are only interested in the pull of the Earth, we can simplify the previous equation. First, we can assume that m1 is always constant (i.e., the Earth doesn’t change mass). Second, and less obviously, we can assume that r is also constant. This is due to the huge distances involved. The distance from the surface of the Earth to its center is so huge (6400 km) that there is almost no difference in gravity between standing at sea level and standing on the top of a mountain. For the accuracy we need in a game, we can therefore assume the r parameter is constant. With these assumptions, the equation is simplified to:


where m is the mass of the object we are simulating, f is the force, as before, and g is a constant that includes the universal gravitational constant, the mass of the Earth,and its radius:


Creating simulations with a g value of 10 ms^−2 can look dull and insipid. Most developers use higher values, from around 15 ms^−2 for shooters (to avoid projectiles having arcs that are too curved) up to 20 ms^−2 typical of driving games. Some developers go further and incorporate the facility to tune the g value on an object-by-object basis.

The acceleration due to gravity can therefore be represented as a vector with the following form:


The Integrator

The integrator consists of two parts—one to update the position of the object, and the other to update its velocity. The position will depend on the velocity and acceleration, while the velocity will depend only on the acceleration.