@@ -1598,13 +1598,15 @@ Key [] ComputeKeys(UnityEngine.Quaternion restRotation, FbxNode node) {
1598
1598
m . SetR ( fbxPreRotationEuler ) ;
1599
1599
fbxPreRotationInverse = m . GetQ ( ) ;
1600
1600
1601
+ var tempRestRotation = fbxPreRotationInverse ;
1602
+
1601
1603
//fbxPreRotationInverse.ComposeSphericalXYZ(fbxPreRotationEuler);
1602
1604
fbxPreRotationInverse . Inverse ( ) ;
1603
1605
1604
1606
// If we're only animating along certain coords for some
1605
1607
// reason, we'll need to fill in the other coords with the
1606
1608
// rest-pose value.
1607
- var lclQuaternion = new FbxQuaternion ( restRotation . x , restRotation . y , restRotation . z , restRotation . w ) ;
1609
+ var lclQuaternion = tempRestRotation ; // new FbxQuaternion(restRotation.x, restRotation.y, restRotation.z, restRotation.w);
1608
1610
1609
1611
// Find when we have keys set.
1610
1612
var keyTimes = new HashSet < float > ( ) ;
@@ -1632,15 +1634,28 @@ Key [] ComputeKeys(UnityEngine.Quaternion restRotation, FbxNode node) {
1632
1634
// pre-rotation
1633
1635
// then pre-rotation inverse
1634
1636
// then animation.
1637
+
1638
+ var result = ModelExporter . ConvertQuaternionToXYZEuler ( fbxFinalAnimation ) ;
1639
+
1640
+ m = new FbxAMatrix ( ) ;
1641
+ m . SetR ( result ) ;
1642
+ fbxFinalAnimation = m . GetQ ( ) ;
1643
+
1635
1644
var fbxQuat = fbxPreRotationInverse * fbxFinalAnimation ;
1645
+ //var unityQuat = new Quaternion ((float)fbxQuat.X, (float)fbxQuat.Y, (float)fbxQuat.Z, (float)fbxQuat.W);
1646
+ //var unityEul = unityQuat.eulerAngles;
1647
+
1648
+ m = new FbxAMatrix ( ) ;
1649
+ m . SetQ ( fbxQuat ) ;
1650
+ var unityEul = m . GetR ( ) ;
1636
1651
1637
1652
// Store the key so we can sort them later.
1638
1653
Key key ;
1639
1654
key . time = FbxTime . FromSecondDouble ( seconds ) ;
1640
- key . euler = ModelExporter . ConvertQuaternionToXYZEuler ( fbxQuat ) ;
1655
+ key . euler = unityEul ; //new FbxVector4(unityEul.x, unityEul.y, unityEul.z); // ModelExporter.ConvertQuaternionToXYZEuler(fbxQuat);
1641
1656
keys [ i ++ ] = key ;
1642
1657
1643
- Debug . Log ( "pre rotation: " + fbxPreRotationEuler + ", complete rotation: " + key . euler ) ;
1658
+ Debug . Log ( "pre rotation: " + fbxPreRotationEuler + ", complete rotation: " + key . euler + ", unity rot: " + unityEul ) ;
1644
1659
}
1645
1660
1646
1661
// Sort the keys by time
0 commit comments