Game Development Reference

In-Depth Information

As a simple example, consider wing panel 1, which is the starboard aileron wing section.

Assume that the wing is set at an initial incidence angle of 3.5° and that the plane is

traveling at a speed of 38.58 m/s in level flight at low altitude with a pitch angle of 4.5°.

This wing section has a chord length of 1.585 m and the span of this section is 1.829 m.

Using the lift and drag data presented in
Figure 15-6
, calculate the lift and drag on this

wing section, assuming the ailerons are not deflected and that the density of air is 1.221

kg/m
3
.

The first step is to calculate the angle of attack, which is 8°, based on the information

provided. Now, looking at
Figure 15-6
, you can find the airfoil lift and drag coefficients

to be 0.92 and 0.013, respectively.

Next, you'll need to calculate the planform area of this section, which is simply its chord

times its span. This yields 2.899 m
2
. Now you have enough information to calculate lift

and drag as follows:

Lift = C
L
(1/2) ρ V
2
S

Lift = 0.92 (1/2) (1.221 kg/m
3
) (38.58 m/s)
2
(2.899 m
2
)

Lift = 2,412.8 N

Drag = C
D
(1/2) ρ V
2
S

Drag = 0.013 (1/2) (1.221 kg/m
3
) (38.58 m/s)
2
(2.899 m
2
)

Drag = 35.6 N

In your simulation, you'll have to perform a similar set of calculations for every com‐

ponent that you've defined. As you can see, using this sort of empirical data and for‐

mulas, although only approximate, lends itself to fairly easy calculations. The hard part

is deciding what to model and finding the right data, and after that the lift and drag

calculations are pretty simple.

We've prepared an example program to show you how to model a simple airplane using

the method shown here. The program is named
FlightSim.exe
and is a real-time, 3D

flight simulator. The small aircraft simulated resembles that shown in
Figure 15-2
.

This program includes the following source files along with a text file (
Instructions.txt
)

that explains the flight controls:

•
Physics.cpp
and
Physics.h

•
D3dstuff.cpp
and
D3dstuff.h

•
Mymath.h

•
Winmain.cpp

As we said, this program is a real-time simulation, and it treats the aircraft as a rigid

body. We've covered real-time simulations earlier in this topic, and
Chapter 12
in par‐