Game Development Reference

In-Depth Information

reduction in drag. This is a result of the flow becoming fully turbulent with a corre‐

sponding reduction in pressure drag.

In the
Cannon2
example in
Chapter 4
, we implemented the ideal formula for air drag on

the projectile. In that case we used a constant value of drag coefficient that was arbitrarily

defined. As we said earlier, it would be better to use the formula presented in this chapter

for total drag along with the total drag coefficient data shown in
Figure 6-9
to estimate

the drag on the projectile. While this is more “accurate,” it does complicate matters for

you. Specifically, the drag coefficient is now a function of the Reynolds number, which

is a function of velocity. You'll have to set up a table of drag coefficients versus the

Reynolds number and interpolate this table given the Reynolds number calculated at

each time step. As an alternative, you can fit the drag coefficient data to a curve to derive

a formula that you can use instead; however, the drag coefficient data may be such that

you'll have to use a piecewise approach and derive curve fits for each segment of the

drag coefficient curve. The sphere data presented herein is one such case. The data does

not lend itself nicely to a single polynomial curve fit over the full range of the Reynolds

number. In such cases, you'll end up with a handful of formulas for drag coefficient,

with each formula valid over a limited range of Reynolds numbers.

While the
Cannon2
example does have its limitations, it is useful to see the effects of drag

on the trajectory of the projectile. The obvious effect is that the trajectory is no longer

parabolic. You can see in
Figure 6-10
that the trajectory appears to drop off much more

sharply when the projectile is making its descent after reaching its apex height.

Figure 6-10. Cannon2 example, trajectories

Another important effect of drag on trajectory (this applies to objects in free fall as well)

is the fact that drag will limit the maximum vertical velocity attainable. This limit is the

so-called
terminal velocity
. Consider an object in free fall for a moment. As the object

accelerates toward the earth at the gravitation acceleration, its velocity increases. As