Game Development Reference
In-Depth Information
Chapter 13
Linear Physics
Simulating the accurate motion and interaction of dynamic objects adds a perva-
sive feeling of realism to a game and can usually be achieved without overly
complex mathematics. This chapter and Chapter 14 discuss several general topics
in classical mechanics that apply to game programming. We begin with an exam-
ination of linear motion, which refers to any motion that is not taking place in a
rotating environment.
13.1 Position Functions
A position function provides the 3D position of an object as a function of time.
Time is usually measured relative to some starting point when the position of an
object is known. For instance, suppose that an object is traveling in a straight line
with a constant velocity
v . If the position of the object at time
=
is known to
t
0
()
be x , then its position
x
t
at any time afterward is given by
()
x
t
=+
x
v
t
.
(13.1)
0
0
A velocity function describes the 3D velocity of an object as a function of
time. The velocity function
()
v of an object is given by the derivative of the po-
sition function with respect to time. The time derivative is commonly denoted by
placing a dot above the function being differentiated:
d
()
()
()
.
(13.2)
v
t
==
x
t
x
t
dt
Since the velocity of the object whose position is given by Equation (13.1) is
constant, its velocity function
()
v
t
is simply given by
()
v
t
=
v .
(13.3)
0
379