Game Development Reference
In-Depth Information
where C w is the drag coefficient, v w is the wind speed, and the minus sign means that
this force opposes the projectile's motion when the wind is blowing in a direction op‐
posite of the projectile's direction of motion. When the wind is blowing with the pro‐
jectile—say, from behind it—then the wind will actually help the projectile along instead
of impede its motion. In general, C w is not necessarily equal to the C d shown in the drag
formula. Referring to Figure 2-3 , we'll define the wind direction as measured by the
angle γ. The x and z components of the wind force can now be written in terms of the
wind direction, γ, as follows:
F wx = F w cos γ = -(C w v w ) cos γ
F wz = F w sin γ = -(C w v w ) sin γ
We ignored the y-direction as we assume the wind is flowing parallel to the ground.
Finally, let's apply a gravitational force to the projectile instead of specifying the effect
of gravity as a constant acceleration, as we did in Chapter 2 . This allows you to include
the force due to gravity in the equations of motion. Assuming that the projectile is
relatively close to sea level, the gravitational force can be written as:
F g = -m g j
where the minus sign indicates that it acts in the negative y-direction (pulling the pro‐
jectile toward the earth), and g on the righthand side of this equation is the acceleration
due to gravity at sea level.
Now that all of the forces have been identified, you can write the equations of motion
in each coordinate direction:
ΣF x = F wx + F dx = m (dv x /dt)
ΣF y = F dy + F gy = m (dv y /dt)
ΣF z = F wz + F dz = m (dv z /dt)
Note here that we already made the substitution dv / dt for acceleration in each equation.
Following the same procedure shown in the previous section, you now need to integrate
each equation of motion twice—once to find an equation for velocity as a function of
time, and another to find an equation for displacement as a function of time. As before,
we'll show you how this is done component by component.
You might be asking yourself, where's the thrust force from the cannon that propels the
projectile in the first place? In this example, we're looking specifically at the motion of
the projectile after it has left the muzzle of the cannon, where there is no longer a thrust
force acting on the projectile; it isn't self-propelled. To account for the effect of the
cannon thrust force, which acts over a very short period of time while the projectile is
within the cannon, you have to consider the muzzle velocity of the projectile when it
initially leaves the cannon. The components of the muzzle velocity in the coordinate
Search Nedrilad ::




Custom Search