Skip to content

Commit 003f949

Browse files
authored
Merge pull request #565 from BabylonJS/drigax/fixEulerToQuaternionConversion
Maya node rotation animation export is incorrect.
2 parents 3364eb0 + 253701d commit 003f949

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Maya/Exporter/BabylonExporter.Animation.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,12 @@ private List<BabylonAnimation> GetAnimation(MFnTransform transform)
305305
foreach (var babylonAnimationKey in babylonAnimationKeys)
306306
{
307307
BabylonVector3 eulerAngles = BabylonVector3.FromArray(babylonAnimationKey.values);
308-
BabylonQuaternion quaternionAngles = eulerAngles.toQuaternion();
308+
BabylonVector3 eulerAnglesRadians = eulerAngles * (float)(Math.PI / 180);
309+
BabylonQuaternion quaternionAngles = eulerAnglesRadians.toQuaternion();
309310
babylonAnimationKey.values = quaternionAngles.ToArray();
310311
}
311312
}
312-
313+
313314
var keysFull = new List<BabylonAnimationKey>(babylonAnimationKeys);
314315

315316
// Optimization

SharedProjects/BabylonExport.Entities/BabylonVector3.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public BabylonQuaternion toQuaternion()
5959

6060
/**
6161
* (Copy pasted from babylon)
62-
* Sets the passed quaternion "result" from the passed float Euler angles (y, x, z).
62+
* Sets the passed quaternion "result" from the passed float Euler angles (radians) (y, x, z).
6363
*/
6464
private BabylonQuaternion RotationYawPitchRollToRefBabylon(float yaw, float pitch, float roll)
6565
{

0 commit comments

Comments
 (0)