Skip to content

Commit

Permalink
Merge pull request #3558 from webaverse/Vis/EmoteBlendPr
Browse files Browse the repository at this point in the history
Fix "Emote animations do not blend when moving" issue.
  • Loading branch information
Avaer Kazmer authored Aug 8, 2022
2 parents 6bb07e3 + fe674ce commit a2dc6de
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions avatars/animationHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,10 @@ export const _applyAnimation = (avatar, now) => {
return spec => {
const {
animationTrackName: k,
boneName,
dst,
lerpFn,
// isTop,
isTop,
isPosition,
} = spec;

Expand All @@ -891,13 +892,26 @@ export const _applyAnimation = (avatar, now) => {
const v2 = src2.evaluate(t2);

const emoteFactorS = avatar.emoteFactor / crouchMaxTime;
const f = Math.min(Math.max(emoteFactorS, 0), 1);
lerpFn
.call(
dst,
localQuaternion.fromArray(v2),
f,
);
let f = Math.min(Math.max(emoteFactorS, 0), 1);

if (boneName === 'Spine' || boneName === 'Chest' || boneName === 'UpperChest' || boneName === 'Neck' || boneName === 'Head') {
if (!isPosition) {
dst.premultiply(localQuaternion.fromArray(v2));
} else {
dst.lerp(localVector.fromArray(v2), f);
}
} else {
if (!isTop) {
f *= (1 - idleWalkFactor);
}

lerpFn
.call(
dst,
localQuaternion.fromArray(v2),
f,
);
}

_clearXZ(dst, isPosition);
};
Expand Down

0 comments on commit a2dc6de

Please sign in to comment.