Conversion from Maya coordinates to Unreal is not as simple as swapping Y with Z?

In Maya I use a script to export the transform of objects to a csv file.

In unreal, I read that data and create an instanced static mesh for each transform.

In order to change coordinate systems, I just swap translate and rotate Y with Z in blueprint.

This only works if only a single axis has rotation values. If there are are values on multiple rotation axis, I end up with incorrect rotations.

Take a look here:

The first four instances are the same as in maya (left side)

These four instances only have rotation values in a single axis

The last three are oriented incorrect. In order to fix the orientation, I have to swap multiple rotation axis and add 180 degrees to one. There must be some formula for this that is needed? And why?

I’m pretty certain that bad math is ruled out in the conversion process because if I enter the values from the data table to a static mesh in the level directly, its the same result. So I think there is more to fixing the coordinates between may and unreal than just swapping the Y and Z.

Problem is, I dont know math at all and I cannot even find anybody asking such a question. Anybody know what issue might be, or what the question is to search?

Is there perhaps something you have to do to convert the rotator somehow?

this might be a situation of “Gimbal Lock” (this is a special situation with Euler angles the trade off of them being easier to understand the Quaternions)

when you rotate a vector by a multiple of 90-decrees then you are now laying an axis on top of another axis, then when you go to rotate the vector again the math could rotate either, but often times it doesn’t matter, and you get strange behavior. (a direct example of this is when you have say the character is supposed to bend their legs 90 degrees, but they end up with the bottom part of the legs in the top part of their legs… it’s funny but a result of Euler Angles)

to address this you could modify Mayas coordinate system to be X forward, Z up, Y right (this might require relearning some workflows if you are used to axis keys.)
just keep in mind you would then have to take special steps working with like Unity (you can look at this thread for steps Maya to Unreal Workflow: World Orientation Z or Y up? - #3 by anonymous_user_048b75c4 )

the other option if you don’t want to change coordinate system in Maya is to pre-rotate the objects in Maya before generating your CSV outputs. as they should map at that point without the possibility of Gimbal Lock on vector math)

1 Like

thanks. I’ll take a look at changing maya to Z up and see if that makes a difference.

I had tried with some rotation offset but that didnt seem to help. Will test it a little more thoroughly though as I did a lot of troublehsooting while frustrated :slight_smile:

it is only for transform of static models, so changing maya rotation isn’t a problem (it can be more annoying with rigs and animation)