Game Development Reference
In-Depth Information
The next calculation is the total mass calculation, which is simply the sum of all element
masses. Immediately following that, we determine the combined center of gravity lo‐
cation using the technique we discussed in Chapter 1 . The coordinates to the combined
center of gravity are referenced to the design coordinate system. You need to subtract
this coordinate from the design coordinate of each element in order to determine each
element's coordinates relative to the combined center of gravity. After that, you're all set
with the exception of the combined moment of inertia tensor, which we already dis‐
cussed in Chapter 11 and Chapter 12 .
Step 2 of our modeling method says you need to collect the airfoil performance data.
For the example program, we used a cambered airfoil with plain flaps to model the wings
and elevators, and we used a symmetric airfoil without flaps to model the tail rudder.
We didn't use flaps for the tail rudder since we just made the whole thing rotate about
a vertical axis to provide rudder action.
For the wings, we set up two functions to handle the lift and drag coefficients:
// Given the attack angle and the status of the flaps, this function
// returns the appropriate lift coefficient for a cambered airfoil with
// a plain trailing-edge flap (+/- 15 degree deflection).
float LiftCoefficient(float angle, int flaps)
float clf0[9] = {−0.54f, −0.2f, 0.2f, 0.57f, 0.92f, 1.21f, 1.43f, 1.4f,
float clfd[9] = {0.0f, 0.45f, 0.85f, 1.02f, 1.39f, 1.65f, 1.75f, 1.38f,
float clfu[9] = {−0.74f, −0.4f, 0.0f, 0.27f, 0.63f, 0.92f, 1.03f, 1.1f,
float a[9] = {−8.0f, −4.0f, 0.0f, 4.0f, 8.0f, 12.0f, 16.0f, 20.0f,
float cl;
int i;
cl = 0;
for (i=0; i<8; i++)
if( (a[i] <= angle) && (a[i+1] > angle) )
case 0:// flaps not deflected
cl = clf0[i] - (a[i] - angle) * (clf0[i] - clf0[i+1]) /
(a[i] - a[i+1]);
case −1: // flaps down
cl = clfd[i] - (a[i] - angle) * (clfd[i] - clfd[i+1]) /
(a[i] - a[i+1]);
Search Nedrilad ::

Custom Search