From 34d9e9b3711a82c1cfc10d92c8b5222c7967a9d3 Mon Sep 17 00:00:00 2001 From: Menithal Date: Tue, 8 Aug 2017 00:03:24 +0300 Subject: [PATCH] Preliminary Research Complete Found the part that needs updating with the AnimationProperty --- .../src/RenderableModelEntityItem.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 911fdf4184..a1d1b9d866 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -282,7 +282,8 @@ bool RenderableModelEntityItem::getAnimationFrame() { const QVector& frames = animation->getFramesReference(); // NOTE: getFrames() is too heavy auto& fbxJoints = animation->getGeometry().joints; - + auto& originalFbxJoints = _model->getFBXGeometry().joints; // model-> isLoaded above makes sure this doesnt crash to an assert! + int frameCount = frames.size(); if (frameCount > 0) { int animationCurrentFrame = (int)(glm::floor(getAnimationCurrentFrame())) % frameCount; @@ -309,9 +310,18 @@ bool RenderableModelEntityItem::getAnimationFrame() { int index = _jointMapping[j]; if (index >= 0) { glm::mat4 translationMat; - if (index < translations.size()) { + + bool _removeme_flag = false; + // this is the part to attack. + // S omethings off even with the original Joints. + if (!_removeme_flag ){ + + translationMat = glm::translate(originalFbxJoints[index].translation); + + } else if (_removeme_flag && index < translations.size()) { translationMat = glm::translate(translations[index]); - } + } + glm::mat4 rotationMat; if (index < rotations.size()) { rotationMat = glm::mat4_cast(fbxJoints[index].preRotation * rotations[index] * fbxJoints[index].postRotation);