From bac9d195be9cfc8d6a0c24e1b6d375d008b3dfe3 Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 3 Aug 2018 17:56:49 -0700 Subject: [PATCH] working on the hand blend alphas, something is wrong with the print out --- libraries/animation/src/AnimBlendLinear.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/animation/src/AnimBlendLinear.cpp b/libraries/animation/src/AnimBlendLinear.cpp index 9b33bd9ea1..e49c3e0060 100644 --- a/libraries/animation/src/AnimBlendLinear.cpp +++ b/libraries/animation/src/AnimBlendLinear.cpp @@ -43,9 +43,16 @@ const AnimPoseVec& AnimBlendLinear::evaluate(const AnimVariantMap& animVars, con size_t prevPoseIndex = glm::floor(clampedAlpha); size_t nextPoseIndex = glm::ceil(clampedAlpha); float alpha = glm::fract(clampedAlpha); + if (prevPoseIndex == nextPoseIndex) { + if (nextPoseIndex == 0) { + nextPoseIndex = 1; + } else if (prevPoseIndex == (_children.size() - 1)) { + prevPoseIndex = (_children.size() - 2); + } + } evaluateAndBlendChildren(animVars, context, triggersOut, alpha, prevPoseIndex, nextPoseIndex, dt); - + qCDebug(animation) << "linear blend alpha " << alpha << " next pose " << _children[nextPoseIndex]->getID() << " previous pose " << _children[prevPoseIndex]->getID(); float weight2 = alpha; float weight1 = 1.0f - weight2; _animStack[_children[prevPoseIndex]->getID()] = weight1 * parentAlpha;