Game Development Reference
In-Depth Information
Matrix3 getTensor();
public:
/**
* Creates a new aerodynamic control surface with the given
* properties.
*/
AeroControl(const Matrix3 &base, const Matrix3 &min,
const Matrix3 &max, const Vector3 &position,
const Vector3 *windspeed);
/**
* Sets the control position of this control. This
* should range between -1 (in which case the minTensor value is
* used) through 0 (where the base-class tensor value is used)
* to +1 (where the maxTensor value is used). Values outside that
* range give undefined results.
*/
void setControl(real value);
/**
* Applies the force to the given rigid body.
*/
virtual void updateForce(RigidBody *body, real duration);
};
Each control surface has an input, wired to the player's (or AI's) control. It ranges
from
1, where 0 is considered the “normal” position. The three tensors match
these three positions. Two of the three tensors are blended together to form a current
aerodynamic tensor for the setting of the surface. This tensor is then converted into
world coordinates and used as before.
1to
+
Putting It Together
On the CD the flightsim demo shows this force generator in operation. You control
a model aircraft (seen from the ground for a bit of added challenge). The only forces
applied to the aircraft are gravity (represented as an acceleration value) and the aero-
dynamic forces from surface and control surface force generators. Figure 11.1 shows
the aircraft in action.
I have used four control surfaces: two wings, a tailplane, and a rudder. The tail-
plane is a regular surface force generator, with no control inputs (in a real plane the
tailplane usually does have control surfaces, but we don't need them). It has the aero-
Search Nedrilad ::




Custom Search