@@ -237,6 +237,12 @@ public void ExportMesh (MeshInfo meshInfo, FbxNode fbxNode, FbxScene fbxScene)
237
237
// get a fbxNode's global default position.
238
238
protected void ExportTransform ( UnityEngine . Transform unityTransform , FbxNode fbxNode )
239
239
{
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
+
240
246
// get local position of fbxNode (from Unity)
241
247
UnityEngine . Vector3 unityTranslate = unityTransform . localPosition ;
242
248
UnityEngine . Vector3 unityRotate = unityTransform . localRotation . eulerAngles ;
@@ -277,12 +283,6 @@ protected int ExportComponents (GameObject unityGo, FbxScene fbxScene, FbxNode
277
283
return - 1 ;
278
284
}
279
285
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
-
286
286
ExportTransform ( unityGo . transform , fbxNode ) ;
287
287
ExportMesh ( GetMeshInfo ( unityGo ) , fbxNode , fbxScene ) ;
288
288
0 commit comments