A simpel flight simulator using roll, pitch and yaw.

I need to rotate an object in its locale coordinates (local space).

Then I must rotate a vector about a perpendicular vector:
Maybe using glRotatef(angle, u1, u2, u3)
Where u1,u2,u3 is the local Y axis of an object, its initial values are u=(0, 1, 0).
Then somehow extract the rotated vector from
the current matrix?

one way would be to create a rotation matrix.
example:

is the rotation axis
angle is the rotation amount in radians
c = cos(angle);
s = sin(angle);
t = 1.0 - c;

| (tx² + c) (txy - sz) (txz + sy) |

M = | (txy + sz) (ty² + c) (tyz - sx) |
| (txz - sy) (tyz + sx) (tz² + c) |

in the above example, the rotation matrix M is built using the rotation axis <xyz> and the rotation angle. to rotate a vector around <xyz> by the angle given just multiply that vector by this matrix.

this technique has it’s roots in quaternions. this implementation can be wrapped up nicely in a function that takes in the angle and vector and outputs the rotation matrix. we use this technique to rotate the objects in our engine.

[This message has been edited by jebus (edited 01-14-2004).]