Skip to content

Commit 0df8743

Browse files
committed
move SetRotationOrder to ExportTransform
1 parent c5aaa53 commit 0df8743

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ public void ExportMesh (MeshInfo meshInfo, FbxNode fbxNode, FbxScene fbxScene)
237237
// get a fbxNode's global default position.
238238
protected void ExportTransform (UnityEngine.Transform unityTransform, FbxNode fbxNode)
239239
{
240+
// Fbx rotation order is XYZ, but Unity rotation order is ZXY.
241+
// This causes issues when converting euler to quaternion, causing the final
242+
// rotation to be slighlty off.
243+
// Fixed if we set the rotation order to the Unity rotation order in the FBX.
244+
fbxNode.SetRotationOrder (FbxNode.EPivotSet.eSourcePivot, FbxEuler.EOrder.eOrderZXY);
245+
240246
// get local position of fbxNode (from Unity)
241247
UnityEngine.Vector3 unityTranslate = unityTransform.localPosition;
242248
UnityEngine.Vector3 unityRotate = unityTransform.localRotation.eulerAngles;
@@ -277,12 +283,6 @@ protected int ExportComponents (GameObject unityGo, FbxScene fbxScene, FbxNode
277283
return -1;
278284
}
279285

280-
// Fbx rotation order is XYZ, but Unity rotation order is ZXY.
281-
// This causes issues when converting euler to quaternion, causing the final
282-
// rotation to be slighlty off.
283-
// Fixed if we set the rotation order to the Unity rotation order in the FBX.
284-
fbxNode.SetRotationOrder (FbxNode.EPivotSet.eSourcePivot, FbxEuler.EOrder.eOrderZXY);
285-
286286
ExportTransform ( unityGo.transform, fbxNode);
287287
ExportMesh (GetMeshInfo( unityGo ), fbxNode, fbxScene);
288288

0 commit comments

Comments
 (0)