Game Development Reference
In-Depth Information
Flap, elevator, and aileron deflections are assumed to happen instantaneously. No
attempt will be made to model the dynamic behavior of these flight control surfaces.
When the plane is traveling down the runway, the rolling friction between the wheels
and ground will be ignored. If you wanted to include that effect in your flight simulator,
a reasonable value for the coefficient of rolling friction for an airplane is m r = 0.015.
The display window in the Flight Simulator will only show the vertical motion of the
airplane. While pitch, yaw, and roll are modeled in the flight simulator, the airplane
cartoon in the display window will not show the airplane pitching or turning.
The GUI display for the flight simulator is shown in Figure 10-24. On the left-hand side of
the display are the user controls. The pilot can change the throttle percentage, angle of attack,
bank angle, and flap deflection of the airplane. Angle of attack was chosen as a user control
rather than pitch angle because it made it easier to control the airplane in flight. Rather than
trying to model a continuously varying flap deflection angle, three flap deflection angles are
available—0, 20, and 40 degrees. The airplane is assumed to take off from sea level where the
altitude (z-location) of the plane is zero. On the right-hand side of the GUI window are text
fields that display the current state of the airplane including the heading angle, climb angle,
airspeed, climb rate, and altitude. At the bottom of the GUI is a status text field that displays
useful information such as “You landed safely” or “The throttle is set to zero.”
When the Reset button is hit, the controls reset to default values and the plane appears on
the ground. To fly the plane, move the throttle control to 100% and press the Start button. The
plane will start to move forward. Actually, the plane will remain in a fixed location in the GUI
and the marker will begin to move. The airspeed as indicated in the text field on the right-hand
side of the GUI will start to increase. If you press the Start button and nothing happens, make
sure that the throttle setting is not set to zero.
When the takeoff speed is reached, the lift generated by the wing is sufficient to overcome
the weight of the airplane. The climb rate, climb angle, and altitude values will start to increase.
When this happens, increase the angle of attack to a positive value to increase lift. Once the
plane is airborne, you can play around with the throttle and angle of attack settings. The plane
can turn by setting the bank angle to a nonzero number. When the plane starts to turn, the
heading angle will change. Setting the bank angle back to zero stops the turn.
Landing is also a part of the Flight Simulator. To decrease altitude, lower the throttle setting
and/or decrease the angle of attack. The quality of your landing is determined by the z-velocity
component when the plane hits the ground. Any value in excess of -5.0 m/s is considered a
crash. A smaller negative z-velocity indicates a safe landing.
The flaps aren't necessary for takeoff in the Flight Simulator, but they can be used to shorten
the distance required for takeoff. The flaps can also be used when landing to increase the lift
and therefore reduce the rate of descent when the airplane is traveling at low speeds.
The Flight Simulator is implemented by three classes, one that defines the GUI and two
that represent propeller airplanes. This version of the Flight Simulator features a Cessna Skyhawk
as the airplane being flown. We'll start by discussing the airplane classes. The PropPlane class
is written to represent a generic propeller airplane. Because the ODE solver will be used to
update the location and velocity of the airplane, the PropPlane class is written as a subclass of
the SimpleProjectile class, which itself is a subclass of the ODE class.
Search WWH ::




Custom Search