From a63b213d65307692563b00fd47b49680ed79eca7 Mon Sep 17 00:00:00 2001 From: Angus Antley Date: Mon, 6 Aug 2018 15:18:17 +0100 Subject: [PATCH] fixed the weight calculation for the hand overlays. to do: check the blends in hmd mode --- libraries/animation/src/AnimBlendLinear.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/animation/src/AnimBlendLinear.cpp b/libraries/animation/src/AnimBlendLinear.cpp index e49c3e0060..2dd4338a5e 100644 --- a/libraries/animation/src/AnimBlendLinear.cpp +++ b/libraries/animation/src/AnimBlendLinear.cpp @@ -46,17 +46,17 @@ const AnimPoseVec& AnimBlendLinear::evaluate(const AnimVariantMap& animVars, con if (prevPoseIndex == nextPoseIndex) { if (nextPoseIndex == 0) { nextPoseIndex = 1; - } else if (prevPoseIndex == (_children.size() - 1)) { - prevPoseIndex = (_children.size() - 2); + } else { + prevPoseIndex = (nextPoseIndex - 1); } } 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; + qCDebug(animation) << "linear blend alpha " << alpha << " and _alpha " << _alpha <<" next pose " << _children[nextPoseIndex]->getID() << " previous pose " << _children[prevPoseIndex]->getID(); + float weight2 = _alpha - (float)prevPoseIndex; float weight1 = 1.0f - weight2; _animStack[_children[prevPoseIndex]->getID()] = weight1 * parentAlpha; - if ((int)nextPoseIndex < _children.size()) { + if (nextPoseIndex < _children.size()) { _animStack[_children[nextPoseIndex]->getID()] = weight2 * parentAlpha; }