Game Development Reference

In-Depth Information

ΣF
z
= m a
z

The resultant force and acceleration vectors are now:

a
= a
x
i
+ a
y
j
+ a
z
k

a =
a
x
2
+
a
y
2
+
a
z
2

Σ
F
= ΣF
x
i
+ ΣF
y
j
+ ΣF
z
k

ΣF =
(
ΣF
x
)
2
+
(
ΣF
y
)
2
+
(
ΣF
z
)
2

To hammer these concepts home, we want to present another example.

Let's go back to the cannon example program discussed in
Chapter 2
. In that example,

we made some simplifying assumptions so we could focus on the kinematics of the

problem without complicating it too much. One of the more significant assumptions

we made was that there was no drag acting on the projectile as it flew through the air.

Physically, this would be valid only if the projectile were moving through a vacuum,

which, of course, is unlikely here on Earth. Another significant assumption we made

was that there was no wind to act on the projectile and affect its course. These two

considerations, drag and wind, are important in real-life projectile problems, so to make

this example a little more interesting—and more challenging to the user if this were an

actual game—we'll add these two considerations now.

First, assume that the projectile is a sphere and the drag force acting on it as it flies

through the air is a function of some drag coefficient and the speed of the projectile.

This drag force can be written as follows:

F
d
= -C
d
v

F
d
= -C
d
v
x
i
- C
d
v
y
j
- C
d
v
z
k

where
C
d
is the drag coefficient,
v
is the velocity of the projectile (
v
x
,
v
y
, and
v
z
are its

components), and the minus sign means that this drag force opposes the projectile's

motion. Actually, we're cheating a bit here since in reality the fluid dynamic drag would

be more a function of speed squared. We're doing this here to facilitate a closed-form

solution. Also, the drag coefficient here would be determined experimentally for each

shape. Later, we'll discuss how experimental data is used on basic shapes to give data for

similar ships.

Second, assume that the projectile is subjected to a blowing wind, the force of which is

a function of some drag coefficient and the wind speed. This force can be written as

follows:

F
w
= -C
w
v
w

F
w
= -C
w
v
wx
i
- C
w
v
wz
k