Game Development Reference

In-Depth Information

Figure 1.5.
Space curve with position and velocity at time
t
.

1.6 Rigid-Body Dynamics

1.6.1 Constant Forces

Suppose we have an object in motion in space. For the moment, we will consider

only a particle with position
x
, or linear motion. If we track this position over

time, we end up with a function
x
(
t
). In addition, we can consider at a particular

time how fast the object is moving and in what direction. This is the velocity

v
(
t
). As the velocity describes how
x
changes in time, it is also the derivative of

its position, or
x
. (See
Figure 1.5
.
)

Assuming that the velocity
v
is constant, we can create a formula for com-

puting the future position of an object from its current position
x
0
and the time

traveled
t
:

x
(
t
)=
x
0
+
v
t.

However, most of the time, velocity is not constant, and we need to consider its

derivative, or acceleration
a
. Assuming
a
is constant, we can create a similar

formula for
v
(
t
):

v
(
t
)=
v
0
+
a
t.

Since velocity is changing at a linear rate, we can substitute the average of the

velocities across our time steps for
v
in our original equation:

x
(
t
)=
x
0
+
t
1

2
(
v
0
+
v
(
t
))

=
x
0
+
t
1

2
(
v
0
+
v
0
+
a
t
)

=
x
0
+
v
0
t
+
1

2
a
t
2
.

(1.4)

Acceleration in turn is derived from a vector quantity known as a force
F
.

Forces act to push and pull an object around in space. We determine the acceler-

ation from force by using Newton's second law of motion,

F
=
m
a
,

where
m
is the mass of the object and is constant.