@@ -36,6 +36,8 @@ public class ModelExporter : System.IDisposable
36
36
37
37
const string ProgressBarTitle = "Fbx Export" ;
38
38
39
+ const int UnitScaleFactor = 100 ;
40
+
39
41
/// <summary>
40
42
/// Create instance of example
41
43
/// </summary>
@@ -356,9 +358,9 @@ public void ExportMesh (MeshInfo meshInfo, FbxNode fbxNode, FbxScene fbxScene, b
356
358
// from m to cm.
357
359
foreach ( var controlPoint in ControlPointToIndex . Keys ) {
358
360
fbxMesh . SetControlPointAt ( new FbxVector4 (
359
- - controlPoint . x * 100 ,
360
- controlPoint . y * 100 ,
361
- controlPoint . z * 100
361
+ - controlPoint . x * UnitScaleFactor ,
362
+ controlPoint . y * UnitScaleFactor ,
363
+ controlPoint . z * UnitScaleFactor
362
364
) , ControlPointToIndex [ controlPoint ] ) ;
363
365
}
364
366
} else {
@@ -370,9 +372,9 @@ public void ExportMesh (MeshInfo meshInfo, FbxNode fbxNode, FbxScene fbxScene, b
370
372
{
371
373
// convert from left to right-handed by negating x (Unity negates x again on import)
372
374
fbxMesh . SetControlPointAt ( new FbxVector4 (
373
- - meshInfo . Vertices [ v ] . x * 100 ,
374
- meshInfo . Vertices [ v ] . y * 100 ,
375
- meshInfo . Vertices [ v ] . z * 100
375
+ - meshInfo . Vertices [ v ] . x * UnitScaleFactor ,
376
+ meshInfo . Vertices [ v ] . y * UnitScaleFactor ,
377
+ meshInfo . Vertices [ v ] . z * UnitScaleFactor
376
378
) , v ) ;
377
379
}
378
380
}
@@ -451,7 +453,11 @@ protected void ExportTransform (UnityEngine.Transform unityTransform, FbxNode fb
451
453
// Negating the x value of the translation, and the y and z values of the rotation
452
454
// to convert from Unity to Maya coordinates (left to righthanded).
453
455
// Scaling the translation by 100 to convert from m to cm.
454
- var fbxTranslate = new FbxDouble3 ( - unityTranslate . x * 100 , unityTranslate . y * 100 , unityTranslate . z * 100 ) ;
456
+ var fbxTranslate = new FbxDouble3 (
457
+ - unityTranslate . x * UnitScaleFactor ,
458
+ unityTranslate . y * UnitScaleFactor ,
459
+ unityTranslate . z * UnitScaleFactor
460
+ ) ;
455
461
var fbxRotate = new FbxDouble3 ( unityRotate . x , - unityRotate . y , - unityRotate . z ) ;
456
462
var fbxScale = new FbxDouble3 ( unityScale . x , unityScale . y , unityScale . z ) ;
457
463
0 commit comments