Converting from RH coordinates to LH

Hello, this seems like a stupid and simple question however I’ve tried everything I can think of and I can’t get my Maya model to export and load into my game properly. The problem I am having is that once ingame my Doom 3 mesh (loaded from md5mesh files) orient’s itself with my ingame coordinate system properly, however, I just wrote a Maya exporter and my Maya exported meshes turn the OPPOSITE direction of my coordinate system when rotating. I’ve tried flipping my Y axis of the mesh on export (as that lines up my Y-axis with my ingame system), I’ve tried everything along those lines including swapping X and Y, then inverting one, inverting the other, etc. Nothing’s worked. This really needs to be a pre-processing step. I looked google and all they say on sites is to invert an axis. That’s what I figured, by why would my model rotate the opposite direction still?

Thanks in advance.

Maya’s default coordinate system is right handed and has the Y axis going up. OTOH, the meshes from Doom3 have Z going up (the way it oughta be :slight_smile: ).

So to put things on good footing you need an x-roll of +90 degrees, I think, either as part of your exporter or as part of the load. Or you could model things with Z going up to begin with (I think).

Does that sound right?

Yes, that sounds correct just to get it into the right coordinate system. I didn’t specifically look at your rotation, however, I have this working already. The problem I’m having is that once ingame, when I rotate the mesh, it rotates the opposite direction.

However, upon thinking about it more and discussing it with a friend I realized that once the vertices are exported, they are fixed, any rotation I do will work for it and be correct, REGARDLESS of the coordinate system. However, I have a skeletal system overlaying everything. Doom 3 provides its own and I’m using that, however if a mesh doesn’t have one on export (my Maya mesh doesn’t) then I generate a default root bone to act as my skeleton. I have a feeling that I have my quaternion inverted and that’s why it rotates the wrong direction. Sound like a possible cause to you?

So the problem is not in the skeleton system. That’s not actually being applied to the orientation. I found that in the transformation in my render if I invert the Y axis the mesh rotates the proper direction when rotating about the Z axis. However it doesn’t rotate around the proper axis when going around Z or Y. It does the following:

Around X it rotates around Y instead.
Around Y it rotates around X instead.

I’m lost. I first invert the Y axis and then I rotate the mesh 90 degrees to get it into my coordinate system though order doesn’t appear to matter. However, how do I get the mesh to rotate around the proper axis AND in the right direction?? I’m lost and very frustrated. I appreciate the help so far.

Got it.

Turns out that as long as I pass in the model view matrix to be the same as the Maya coordinate system then I’m alright. OpenGL handles the rest. However, my problem was that I needed to pass in the transpose of my matrix. I was passing it in, but the wrong one. Turns out I was transposing it before I put it in without realizing it. I took my standard rotation matrix and position, converted it into my 4x4 matrix and boom, there it was. Normally that’s the first thing I try…

Thanks for the help.