Game Development Reference

In-Depth Information

It is important to notice here that this does not give a formula for instantaneous velocity;

instead, it gives you only an approximation of the change in velocity. Thus, to approx‐

imate the actual velocity of your particle (or rigid body), you have to know what its

velocity was before the time change ∆
t
. At the start of your simulation, at time 0, you

have to know the starting velocity of your particle. This is an initial condition and is

required in order to uniquely define your particle's velocity as you step through time

using this equation:
1

v
t+∆t
= v
t
+ (F/m) ∆t

where the initial condition is:

v
t=0
= v
0

Here
v
t
is velocity at some time
t
,
v
t+∆t
is velocity at some time plus the time step, ∆
t
is

the time step, and
v
0
is the initial velocity at time 0.

You can integrate the linear equation of motion one more time in order to approximate

your particle's displacement (or position). Once you've determined the new velocity

value, at time
t
+ ∆
t
, you can approximate displacement using:

s
t+∆t
= s
t
+ ∆t (v
t+∆t
)

where the initial condition on displacement is:

s
t=0
= s
0

The integration technique discussed here is known as Euler's method, and it is the most

basic integration method. While Euler's method is easy to grasp and fairly straightfor‐

ward to implement, it isn't necessarily the most accurate method.

You can reason that the smaller you make your time step—that is, as ∆
t
approaches
dt

—the closer you'll get to the exact solution. There are, however, computational problems

associated with using very small time steps. Specifically, you'll need a huge number of

calculations at very small ∆
t
's, and since your calculations won't be exact (depending

on numerical precision you'll be rounding off and truncating numbers), you'll end up

with a buildup of round-off error. This means that there is a practical limit as to how

small a time step you can take. Fortunately, there are several numerical integration

techniques at your disposal that are designed to increase accuracy for reasonable step

sizes.

1. In mathematics, this sort of problem is termed an
initial value problem
.