3D Rotation

I've been in other forums for this but no reply yet, it's quiet on here tonight so I figure I might else well ask :)

Alright, so I've got a Model of a spaceship, it's model faces the screen. As in the cockpit is the front of the model. I'm working on a simple boids algorithm that works. My problem is the rotation of the model whey they are flying around is buggered. They fly as if the left wing of the shuttle is the front of the model. And sometimes even go flat, the model becomes 2D? I'm using gamebryo as my graphics / math library. In gamebryo the Z axis is up and the Y axis is into the screen I think. If anyone can solve what I'm doing wrong with this math it'd be appreciated, I've gone brain dead again!

This code I'm using here makes the models left wing as if it was the front of the shuttle. So they all fly sideways in other words.

m_Direction is a normalized vector3 (NiPoint3).
1
2
3
4
5
6
7
NiPoint3 YAxis(0,1,0);
NiPoint3 ZAxis = m_Direction.Cross(YAxis);
YAxis = ZAxis.Cross(m_Direction);

//                            (col0       , col1 , col2 );
NiMatrix3 Rotation = NiMatrix3(m_Direction, YAxis, ZAxis);
m_Mesh->SetRotate(Rotation);

Thanks heaps guys.
Last edited on
Topic archived. No new replies allowed.