Game Development Reference
In-Depth Information
Iyz += Element[i].fMass * (Element[i].vCGCoords.y *
Element[i].vCGCoords.z);
}
// Finally, set up the airplane's mass and its inertia matrix and take the
// inverse of the inertia matrix.
Airplane.fMass = mass;
Airplane.mInertia.e11 = Ixx;
Airplane.mInertia.e12 = -Ixy;
Airplane.mInertia.e13 = -Ixz;
Airplane.mInertia.e21 = -Ixy;
Airplane.mInertia.e22 = Iyy;
Airplane.mInertia.e23 = -Iyz;
Airplane.mInertia.e31 = -Ixz;
Airplane.mInertia.e32 = -Iyz;
Airplane.mInertia.e33 = Izz;
Airplane.mInertiaInverse = Airplane.mInertia.Inverse();
}
Among other things, this function essentially completes step 1 (and part of step 2) of
our modeling method: discretize the airplane into a number of smaller pieces, each with
its own mass and lift and drag properties. For this model we chose to use eight pieces,
or elements, to describe the aircraft. Our comments at the beginning of the function
explain what each element represents.
The very first thing this function does is initialize the elements with the properties that
we've defined to approximate the aircraft. Each element is given a mass, a set of design
coordinates to its center of mass, a set of moments of inertia about each element's center
of mass, an initial incidence angle, a planform area, and a dihedral angle .
The design coordinates are the coordinates of the element with respect to an origin
located at the very tip of the aircraft's tail, on its centerline and at its baseline. The x-axis
of this system points toward the nose of the aircraft, while the y-axis points toward the
port side. The z-axis points up. You have to set up your elements in this design coordinate
system first because you don't yet know the location of the whole aircraft's center of
mass, which is the combined center of mass of all of the elements. Ultimately, you want
each element referenced from the combined center of mass because it's the center of
mass that you'll track during the simulation.
The dihedral angle is the angle about the x-axis at which the element is initially set. For
our model, all of the elements have a 0 dihedral angle; that is, they are horizontal, except
for the tail rudder, which has a 90° dihedral since it is oriented vertically.
After we've set up the elements, the first calculation that this function performs is to
find the unit normal vector to each element's surface based on the element's incidence
and dihedral angles. You need this direction vector to help calculate the angle of attack
between the airflow and the element.
Search Nedrilad ::




Custom Search