So for a quick sample in pictures:
This is normal:
this is after rotating 180 deg on either the X or Y axis:
I don't see why this is happening at all. I'm using OpenTK to render a simple Bullet physics scene. The code is straight forward and it almost seems like there's something wrong in the way the matrix is handled. It's straight-forward render code:
GL.PushMatrix();
GL.MultMatrix(Body.MotionState.WorldTransform.ToArray());
GL.Scale(HalfX * 2, HalfY * 2, HalfZ * 2);
GL.Color4(Color4.Blue);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(0, 0, 0);
GL.Vertex3(0, 0, 10);
GL.End();
GL.Color4(Color4.Yellow);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(0, 0, 0);
GL.Vertex3(0, 10, 0);
GL.End();
GL.Color4(Color4.Green);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(0, 0, 0);
GL.Vertex3(10, 0, 0);
GL.End();
if (Body.ActivationState == ActivationState.ActiveTag)
{
GL.Color4(Color4.Blue);
}
else if (Mass == 0)
{
GL.Color4(Color4.Red);
}
else
{
GL.Color4(Color4.Green);
}
model.Draw();
GL.PopMatrix();
I've tried breaking it down to it's components: the translation vector is fine, scaling is fine, rotating on the Z axis appears fine... it's when you add rotations on the X or Y axis that it starts flying. I have console output going: the box is at exactly 6.9999 on the Z axis in both images.
Where am I going wrong? What am I missing? How do I fix this?!