fixed the weight calculation for the hand overlays. to do: check the blends in hmd mode

This commit is contained in:
Angus Antley 2018-08-06 15:18:17 +01:00
parent bac9d195be
commit a63b213d65

View file

@ -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;
}