Moving forward

Say i have 3 vectors (Left, Up and In)representing a rotation matrix that is my spaceship orientation. And a vector (Pos) that represents position in 3d space.

How do i adjust the position vector to move the spaceship forward along the local z vector?

I tried this code but it doesn’t work properly:

//Move ship
Vector v(In.x, In.y, In.z);
Pos += v;

On a first glance it looks ok, what doesn’t work? how does it act improperly?

The ship just seems to move toward the origin. It doesn’t fly forward.

Maybe you could try drawing 3 GL_LINES from Pos to Left, Up, and In (in red green and blue) to make sure that In actually faces the direction you expect it to.

If you have already done this, then some more of your source might be helpful.

I solved it. That method does work, after i extract the “In” vector from the matrix i put it in, it works.

/me scratches his head. lol