3D Flight animation

Flight At first look at flying Elephant (6.4kb you will fly with Elephant if you choose the "Fly" viewpoint :) Flight Interpolator PROTO.

Cardinal splines curve C(t) can be used for a JavaScript Spline PositionInterpolator PROTO "node" (see also Spline PositionInterpolator Demo with control points and path).

For flight animation we need to set orientation of our model (airplane) next. The tangent direction N for a Bezier spline curve is
    N(t) = d/dt C(t) = S dBi(t)/dt Pi.

But we can use an approximate expression for derivative too
    Ni ~ (Ci+1 - Ci ).
Let our model initially is oriented in X direction and is parallel to the XZ plane (i.e. with zero banking). To set it in the tangent N direction we can use two rotations (see pictures below): the first rotation around the Z axis on angle q and then the second rotation around the Y axis on angle f.
It is evident, that this transformation keeps zero banking. We can set any banking angle (the phi field in the Flight Interpolator PROTO) by rotation of our model around the X axis before this transformation.
Rotation Rotation 2
"Unfortunately" for Nx < 0 you can make this transformation in the two different ways (see the second picture). You can rotate model on q2 > p /2 (Demo 1) or make the first rotation on angle q1 < p /2 ( q2 = p - q1 ) and the second one on f = p (Demo 2). You see, that all these Demos are not perfect. In this Demo 3 we use the first type rotation for the vertical loop and the second type one for the horizontal loop. The type of rotation is set by the sign of the key field! And switch type of rotation at Nx > 0, when these transformations coincide. You can make a flight path in "sPatch" at first. Please write me if you know more natural way to set model's orientation.

As since an orientation (rotation) object includes axis and angle of rotation (a vector and a number) therefore one can easy make Spline OrientationIterpolator PROTO for viewpoint (camera) animation if the linear OrientationIterpolator node is not enough.


updated 5 April 2001