Game Development Reference

In-Depth Information

Figure 6-4. Projectile dropped from a moving system

Table 6-4
shows the formulas to use to solve this type of problem. Note here that when

v
o
is 0, the problem reduces to a simple free-fall problem in which the projectile drops

straight down.

Table 6-4. Formulas—projectile dropped from a moving system

To calculate: Use this formula:

x(t) v
o
t

y(t)
h - (g t
2
) / 2

v
x
(t) v
o

v
y
(t) - g t

v(t)
v
0
2

+
g
2
t
2

h

(g t
2
) / 2

R

v
o
T

T

2
h

g

These formulas are useful if you're writing a game that does not require a more accurate

treatment of projectile motion—that is, if you don't need or want to consider the other

forces that can act on a projectile when in motion. If you are going for more accuracy,

you'll have to consider these other forces and treat the problem as we did in
Chap‐

ter 4
's example.

Drag

In
Chapter 3
and
Chapter 4
, we showed you the idealized formulas for viscous fluid

dynamic drag as well as how to implement drag in the equations of motion for a pro‐