From dd3f43705c9d5232c1038af08a3c8e0168f1271e Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 23 Nov 2015 11:06:11 -0800 Subject: [PATCH] Fix for Model Entity animations. Because rig->setJoint* methods take parameters in geometry space the animations preRotation has to be applied manually. --- libraries/entities/src/ModelEntityItem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index b4adde7467..af9541ceca 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -224,6 +224,7 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame, if (myAnimation && myAnimation->isLoaded()) { const QVector& frames = myAnimation->getFramesReference(); // NOTE: getFrames() is too heavy + auto& fbxJoints = myAnimation->getGeometry().joints; int frameCount = frames.size(); if (frameCount > 0) { @@ -244,7 +245,7 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame, for (int j = 0; j < _jointMapping.size(); j++) { int index = _jointMapping[j]; if (index != -1 && index < rotations.size()) { - _lastKnownFrameDataRotations[j] = rotations[index]; + _lastKnownFrameDataRotations[j] = fbxJoints[index].preRotation * rotations[index]; } if (index != -1 && index < translations.size()) { _lastKnownFrameDataTranslations[j] = translations[index];