Game Development Reference
In-Depth Information
float aa = (float) fabs(angle);
cd = 0.5;
for (i=0; i<8; i++)
{
if( (a[i] <= aa) && (a[i+1] > aa) )
{
cd = cdf0[i] - (a[i] - aa) * (cdf0[i] - cdf0[i+1]) /
(a[i] - a[i+1]);
break;
}
}
return cd;
}
With steps 1 and 2 out of the way, steps 3, 4, and 5 are handled in a single function called
CalcAirplaneLoads :
//------------------------------------------------------------------------//
// This function calculates all of the forces and moments acting on the
// plane at any given time.
//------------------------------------------------------------------------//
void CalcAirplaneLoads(void)
{
Vector Fb, Mb;
// reset forces and moments:
Airplane.vForces.x = 0.0f;
Airplane.vForces.y = 0.0f;
Airplane.vForces.z = 0.0f;
Airplane.vMoments.x = 0.0f;
Airplane.vMoments.y = 0.0f;
Airplane.vMoments.z = 0.0f;
Fb.x = 0.0f; Mb.x = 0.0f;
Fb.y = 0.0f; Mb.y = 0.0f;
Fb.z = 0.0f; Mb.z = 0.0f;
// Define the thrust vector, which acts through the plane's CG
Thrust.x = 1.0f;
Thrust.y = 0.0f;
Thrust.z = 0.0f;
Thrust *= ThrustForce;
// Calculate forces and moments in body space:
Vector vLocalVelocity;
float fLocalSpeed;
Vector vDragVector;
Vector vLiftVector;
float fAttackAngle;
float tmp;
Vector vResultant;
Search Nedrilad ::




Custom Search