From 8f71a5fda548e3a7e2f424b2fd08abb2be4476af Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 30 Dec 2015 10:17:18 -0800 Subject: [PATCH] ModelEntityItem: Fix for missing pre-rotations for animated models. This should fix the issue with the Kaya and Claire models, while also not breaking the windmill model in demo. --- libraries/entities/src/ModelEntityItem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index a1f16ee251..9215374653 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -252,9 +252,11 @@ void ModelEntityItem::getAnimationFrame(bool& newFrame, if (index < translations.size()) { translationMat = glm::translate(translations[index]); } - glm::mat4 rotationMat; + glm::mat4 rotationMat(glm::mat4::_null); if (index < rotations.size()) { - rotationMat = glm::mat4_cast(rotations[index]); + rotationMat = glm::mat4_cast(fbxJoints[index].preRotation * rotations[index] * fbxJoints[index].postRotation); + } else { + rotationMat = glm::mat4_cast(fbxJoints[index].preRotation * fbxJoints[index].postRotation); } glm::mat4 finalMat = (translationMat * fbxJoints[index].preTransform * rotationMat * fbxJoints[index].postTransform);