Game Development Reference
In-Depth Information
at a given point. This is the point at which all its force will be felt. We can attach as
many surfaces as we need. The force generator looks like this:
Excerpt from include/cyclone/fgen.h
/**
* A force generator that applies an aerodynamic force.
*/
class Aero : public ForceGenerator
{
/**
* Holds the aerodynamic tensor for the surface in body space.
*/
Matrix3 tensor;
/**
* Holds the relative position of the aerodynamic surface
* in body coordinates.
*/
Vector3 position;
/**
* Holds a pointer to a vector containing the wind speed of
* the environment. This is easier than managing a separate
* wind speed vector per generator and having to update
* it manually as the wind changes.
*/
const Vector3* windspeed;
public:
/**
* Creates a new aerodynamic force generator with the
* given properties.
*/
Aero(const Matrix3 &tensor, const Vector3 &position,
const Vector3 *windspeed);
/**
* Applies the force to the given rigid body.
*/
virtual void updateForce(RigidBody *body, real duration);
};
The air velocity is calculated based on two values—the prevailing wind and the
velocity of the rigid body. The prevailing wind is a vector containing both the direc-
Search Nedrilad ::




Custom Search