Game Development Reference
In-Depth Information
z
t
Figure 4-3.
A general z-location vs. time curve
The issue that remains is where should the velocity,
v
z
(
z,t
), be evaluated. A natural choice
would be to evaluate the velocity at the known conditions,
z
n
and
t
n
.
(
)
Δ=
zz
− =
z vzt
,
Δ
t
(4.22)
n
+
1
n
z
n
n
This approach is known as
Euler's method
. Unfortunately, Euler's method is not accurate
unless the slope of the velocity curve is more or less constant between times
t
n
and
t
n
+ Dt
. If the
slope of the velocity curve changes significantly between the two time levels, errors will be
introduced into the solution. To see how this happens, let's look at a close-up view of one part
of the velocity curve shown in Figure 4-3. In Figure 4-4, the dashed line shows the value of
z
n+1
computed by Euler's method, which computes the z-location based on the velocity at time
t
n
.
Because the slope of the velocity curve decreases over time, Euler's method overpredicts what
the z-location will be at time
t
n
+ Dt
.
Figure 4-4.
Euler's method is inaccurate if the curve is not linear.