Game Development Reference
second possible adjustment approach from section 11.2.1: rotating the control sur-
face. The force generator looks like this:
Excerpt from include/cyclone/fgen.h
* A force generator with an aerodynamic surface that can be re-oriented
* relative to its rigid body. This derives the
class AngledAero : public Aero
* Holds the orientation of the aerodynamic surface relative
* to the rigid body to which it is attached.
* Creates a new aerodynamic surface with the given properties.
Aero(const Matrix3 &tensor, const Vector3 &position,
const Vector3 *windspeed);
* Sets the relative orientation of the aerodynamic surface relative
* to the rigid body it is attached to. Note that this doesn't affect
* the point of connection of the surface to the body.
void setOrientation(const Quaternion &quat);
* Applies the force to the given rigid body.
virtual void updateForce(RigidBody *body, real duration);
Notice that the generator keeps an orientation for the surface and uses this, in
combination with the orientation of the rigid body, to create a final transformation
for the aerodynamic surface. There is only one tensor, but the matrix by which it is
transformed is now the combination of the rigid body's orientation and the adjustable
orientation of the control surface.
Although I won't add them to our example, we could also add wings to the boat:
hydrofoils to lift it out of the water. These act just like wings on an aircraft, producing
vertical lift. Typically on a hydrofoil boat they are positioned lower than any part of