Game Development Reference
In-Depth Information
ThrustForce = _MAXTHRUST;
}
void DecThrust(void)
{
ThrustForce -= _DTHRUST;
if(ThrustForce < 0)
ThrustForce = 0;
}
IncThrust simply increases the thrust by _DTHRUST checking to make sure it does not
exceed _MAXTHRUST . We've defined _DTHRUST and _MAXTHRUST as follows:
#define _DTHRUST 100.0f
#define _MAXTHRUST 3000.0f
DecThrust , on the other hand, decreases the thrust by _DTHRUST checking to make sure
it does not fall below 0.
To control yaw, we've prepared three functions that manipulate the rudder:
void LeftRudder(void)
{
Element[6].fIncidence = 16;
}
void RightRudder(void)
{
Element[6].fIncidence = −16;
}
void ZeroRudder(void)
{
Element[6].fIncidence = 0;
}
LeftRudder changes the incidence angle of Element[6] , the vertical tail rudder, to 16
degrees, while RightRudder changes the incidence angle to −16 degrees. ZeroRudder
centers the rudder at 0 degrees.
The ailerons, or flaps, are manipulated by these functions to control roll:
void RollLeft(void)
{
Element[0].iFlap = 1;
Element[3].iFlap = −1;
}
void RollRight(void)
{
Element[0].iFlap = −1;
Element[3].iFlap = 1;
}
Search Nedrilad ::




Custom Search