An efficient solution to dealing with the discrepancy between Maya and Unity is to act on Maya's side and rotate the model on its y axis there. Though, as we write, this problem is going to be solved soon by Maya LT, we offer a solution here that prevents the imported FBX file from acting strangely once they are turned into prefabs in Unity. The idea is to use the so-called "groups" to apply the transformations required and yet get a clean hierarchy for the prefab to appear in Unity. Let's see how to do it.
Open the scene again with the model we used before and be ready to follow our instructions.
In this recipe, we will show you how to use groups and hierarchies in Maya to export a model that will not show its back once it gets imported into Unity. Have the Maya scene open on your screen.
rot_180
(this is actually just for reference so we know what the group means).rot_180
group selected in the hierarchy, press Ctrl+G again to create another group. Name this group export
after double-clicking on the group name in the hierarchy.By using one group for flipping the model on the y axis and another to make a selection featuring neither rotations nor translations for the export, we made sure that the FBX file won't have any unexpected rotation or position offsets that will affect its behavior once it gets scripted into the code in Unity.
Another technique we will only mention here is to use your programming skills and code an AssetPostprocessor
class to handle the process automatically.
AssetPostprocessor
is a class in Unity, provided with several methods to act on the pipeline for importing assets into Unity.
What one could do is add a custom attribute to the model in Maya, something like turn me 180 degrees on the y axis when imported, and let the AssetPostprocessor
class read this attribute and perform the transformation.
You can learn more about the AssetPostprocessor
class by checking the scripting reference guide at http://docs.unity3d.com/ScriptReference/AssetPostprocessor.html.
18.191.235.176