Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Sil/Sword combat and aim animation problem while walking/running. #2791

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d6f72e1
branch: dev2.
gonnavis Apr 7, 2022
1642d8c
branch: AnimationsOrigin.
gonnavis Apr 7, 2022
0948491
fix bow not work bug. && dev.
gonnavis Apr 7, 2022
d17c77b
dev
gonnavis Apr 8, 2022
a2ee1c2
dev. && add pistol & rifle.
gonnavis Apr 8, 2022
024ab7a
branch: AnimSwordWalk.
gonnavis Apr 8, 2022
d7f6681
lerp leg between sword and walk/run by idleWalkFactor.
gonnavis Apr 8, 2022
f055d6d
lerp full combo animation ( which already processed legs ) when start…
gonnavis Apr 8, 2022
8c6c993
use isCombo instead of isTop.
gonnavis Apr 8, 2022
9d869b7
trim combo animation's start a little.
gonnavis Apr 8, 2022
8f576d3
trim combo animation's end to prevent sword cross player's head.
gonnavis Apr 8, 2022
c7a3435
Merge branch 'master' into AnimSwordWalk
gonnavis Apr 8, 2022
de84155
add silsword.
gonnavis Apr 8, 2022
d71e237
handle crouch sword.
gonnavis Apr 9, 2022
939d70f
clean.
gonnavis Apr 9, 2022
93e5d3b
fix aimAnimation while walk/run.
gonnavis Apr 9, 2022
b8db971
blend walk/run into arms when aiming.
gonnavis Apr 11, 2022
aeefba5
fix timing problem.
gonnavis Apr 11, 2022
b6c23c0
fix unuseAnimation not stop problem.
gonnavis Apr 11, 2022
f927d5a
new sword animations.
gonnavis Apr 11, 2022
f056c61
move trimClip() from runtime to baker.
gonnavis Apr 14, 2022
2f87848
use isArm instead of isCombo.
gonnavis Apr 14, 2022
e16eb6a
check !isArm instead of isArm. && clean.
gonnavis Apr 14, 2022
f5392da
add `isLastBone`.
gonnavis Apr 14, 2022
8dfa702
slowdown sword aiming animation.
gonnavis Apr 15, 2022
441b049
generally handle end-action transition.
gonnavis Apr 15, 2022
3c365d3
Revert "generally handle end-action transition."
gonnavis Apr 15, 2022
dd0ea6f
set `unuseAnimation = null` at outter.
gonnavis Apr 15, 2022
276f6b5
Merge branch 'master' into AnimSwordWalkPr
gonnavis Apr 18, 2022
a923e49
Rebuild animations.z.
gonnavis Apr 18, 2022
871866e
add comment.
gonnavis Apr 18, 2022
1f4de6c
Merge branch 'master' into AnimSwordWalkPr
gonnavis Apr 19, 2022
4dc4625
revert fixing of useAnimation not stop problem, may try in another PR.
gonnavis Apr 19, 2022
f6c2fe4
del trimClip().
gonnavis Apr 28, 2022
713446d
revert changes of useAnimation.
gonnavis May 2, 2022
fdd9f79
improve & clean aimAnimation.
gonnavis May 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 56 additions & 55 deletions avatars/AnimationMapping.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
class AnimationMapping {
constructor(animationTrackName, boneName, isTop, isPosition) {
constructor(animationTrackName, boneName, isTop, isPosition, isArm) {
this.animationTrackName = animationTrackName;
this.boneName = boneName;
this.isTop = isTop;
this.isArm = isArm;
this.isPosition = isPosition;
}

clone() {
return new AnimationMapping(this.animationTrackName, this.boneName, this.isTop, this.isPosition);
return new AnimationMapping(this.animationTrackName, this.boneName, this.isTop, this.isPosition, this.isArm);
}
}

export const animationMappingConfig = [
new AnimationMapping('mixamorigHips.position', 'Hips', false, true),
new AnimationMapping('mixamorigHips.quaternion', 'Hips', false, false),
new AnimationMapping('mixamorigSpine.quaternion', 'Spine', true, false),
new AnimationMapping('mixamorigSpine1.quaternion', 'Chest', true, false),
new AnimationMapping('mixamorigSpine2.quaternion', 'UpperChest', true, false),
new AnimationMapping('mixamorigNeck.quaternion', 'Neck', true, false),
new AnimationMapping('mixamorigHead.quaternion', 'Head', true, false),
new AnimationMapping('mixamorigHips.position', 'Hips', false, true, false),
new AnimationMapping('mixamorigHips.quaternion', 'Hips', false, false, false),
new AnimationMapping('mixamorigSpine.quaternion', 'Spine', true, false, false),
new AnimationMapping('mixamorigSpine1.quaternion', 'Chest', true, false, false),
new AnimationMapping('mixamorigSpine2.quaternion', 'UpperChest', true, false, false),
new AnimationMapping('mixamorigNeck.quaternion', 'Neck', true, false, false),
new AnimationMapping('mixamorigHead.quaternion', 'Head', true, false, false),

new AnimationMapping('mixamorigLeftShoulder.quaternion', 'Left_shoulder', true, false),
new AnimationMapping('mixamorigLeftArm.quaternion', 'Left_arm', true, false),
new AnimationMapping('mixamorigLeftForeArm.quaternion', 'Left_elbow', true, false),
new AnimationMapping('mixamorigLeftHand.quaternion', 'Left_wrist', true, false),
new AnimationMapping('mixamorigLeftHandMiddle1.quaternion', 'Left_middleFinger1', true, false),
new AnimationMapping('mixamorigLeftHandMiddle2.quaternion', 'Left_middleFinger2', true, false),
new AnimationMapping('mixamorigLeftHandMiddle3.quaternion', 'Left_middleFinger3', true, false),
new AnimationMapping('mixamorigLeftHandThumb1.quaternion', 'Left_thumb0', true, false),
new AnimationMapping('mixamorigLeftHandThumb2.quaternion', 'Left_thumb1', true, false),
new AnimationMapping('mixamorigLeftHandThumb3.quaternion', 'Left_thumb2', true, false),
new AnimationMapping('mixamorigLeftHandIndex1.quaternion', 'Left_indexFinger1', true, false),
new AnimationMapping('mixamorigLeftHandIndex2.quaternion', 'Left_indexFinger2', true, false),
new AnimationMapping('mixamorigLeftHandIndex3.quaternion', 'Left_indexFinger3', true, false),
new AnimationMapping('mixamorigLeftHandRing1.quaternion', 'Left_ringFinger1', true, false),
new AnimationMapping('mixamorigLeftHandRing2.quaternion', 'Left_ringFinger2', true, false),
new AnimationMapping('mixamorigLeftHandRing3.quaternion', 'Left_ringFinger3', true, false),
new AnimationMapping('mixamorigLeftHandPinky1.quaternion', 'Left_littleFinger1', true, false),
new AnimationMapping('mixamorigLeftHandPinky2.quaternion', 'Left_littleFinger2', true, false),
new AnimationMapping('mixamorigLeftHandPinky3.quaternion', 'Left_littleFinger3', true, false),
new AnimationMapping('mixamorigLeftShoulder.quaternion', 'Left_shoulder', true, false, true),
new AnimationMapping('mixamorigLeftArm.quaternion', 'Left_arm', true, false, true),
new AnimationMapping('mixamorigLeftForeArm.quaternion', 'Left_elbow', true, false, true),
new AnimationMapping('mixamorigLeftHand.quaternion', 'Left_wrist', true, false, true),
new AnimationMapping('mixamorigLeftHandMiddle1.quaternion', 'Left_middleFinger1', true, false, true),
new AnimationMapping('mixamorigLeftHandMiddle2.quaternion', 'Left_middleFinger2', true, false, true),
new AnimationMapping('mixamorigLeftHandMiddle3.quaternion', 'Left_middleFinger3', true, false, true),
new AnimationMapping('mixamorigLeftHandThumb1.quaternion', 'Left_thumb0', true, false, true),
new AnimationMapping('mixamorigLeftHandThumb2.quaternion', 'Left_thumb1', true, false, true),
new AnimationMapping('mixamorigLeftHandThumb3.quaternion', 'Left_thumb2', true, false, true),
new AnimationMapping('mixamorigLeftHandIndex1.quaternion', 'Left_indexFinger1', true, false, true),
new AnimationMapping('mixamorigLeftHandIndex2.quaternion', 'Left_indexFinger2', true, false, true),
new AnimationMapping('mixamorigLeftHandIndex3.quaternion', 'Left_indexFinger3', true, false, true),
new AnimationMapping('mixamorigLeftHandRing1.quaternion', 'Left_ringFinger1', true, false, true),
new AnimationMapping('mixamorigLeftHandRing2.quaternion', 'Left_ringFinger2', true, false, true),
new AnimationMapping('mixamorigLeftHandRing3.quaternion', 'Left_ringFinger3', true, false, true),
new AnimationMapping('mixamorigLeftHandPinky1.quaternion', 'Left_littleFinger1', true, false, true),
new AnimationMapping('mixamorigLeftHandPinky2.quaternion', 'Left_littleFinger2', true, false, true),
new AnimationMapping('mixamorigLeftHandPinky3.quaternion', 'Left_littleFinger3', true, false, true),

new AnimationMapping('mixamorigRightShoulder.quaternion', 'Right_shoulder', true, false),
new AnimationMapping('mixamorigRightArm.quaternion', 'Right_arm', true, false),
new AnimationMapping('mixamorigRightForeArm.quaternion', 'Right_elbow', true, false),
new AnimationMapping('mixamorigRightHand.quaternion', 'Right_wrist', true, false),
new AnimationMapping('mixamorigRightHandMiddle1.quaternion', 'Right_middleFinger1', true, false),
new AnimationMapping('mixamorigRightHandMiddle2.quaternion', 'Right_middleFinger2', true, false),
new AnimationMapping('mixamorigRightHandMiddle3.quaternion', 'Right_middleFinger3', true, false),
new AnimationMapping('mixamorigRightHandThumb1.quaternion', 'Right_thumb0', true, false),
new AnimationMapping('mixamorigRightHandThumb2.quaternion', 'Right_thumb1', true, false),
new AnimationMapping('mixamorigRightHandThumb3.quaternion', 'Right_thumb2', true, false),
new AnimationMapping('mixamorigRightHandIndex1.quaternion', 'Right_indexFinger1', true, false),
new AnimationMapping('mixamorigRightHandIndex2.quaternion', 'Right_indexFinger2', true, false),
new AnimationMapping('mixamorigRightHandIndex3.quaternion', 'Right_indexFinger3', true, false),
new AnimationMapping('mixamorigRightHandRing1.quaternion', 'Right_ringFinger1', true, false),
new AnimationMapping('mixamorigRightHandRing2.quaternion', 'Right_ringFinger2', true, false),
new AnimationMapping('mixamorigRightHandRing3.quaternion', 'Right_ringFinger3', true, false),
new AnimationMapping('mixamorigRightHandPinky1.quaternion', 'Right_littleFinger1', true, false),
new AnimationMapping('mixamorigRightHandPinky2.quaternion', 'Right_littleFinger2', true, false),
new AnimationMapping('mixamorigRightHandPinky3.quaternion', 'Right_littleFinger3', true, false),
new AnimationMapping('mixamorigRightShoulder.quaternion', 'Right_shoulder', true, false, true),
new AnimationMapping('mixamorigRightArm.quaternion', 'Right_arm', true, false, true),
new AnimationMapping('mixamorigRightForeArm.quaternion', 'Right_elbow', true, false, true),
new AnimationMapping('mixamorigRightHand.quaternion', 'Right_wrist', true, false, true),
new AnimationMapping('mixamorigRightHandMiddle1.quaternion', 'Right_middleFinger1', true, false, true),
new AnimationMapping('mixamorigRightHandMiddle2.quaternion', 'Right_middleFinger2', true, false, true),
new AnimationMapping('mixamorigRightHandMiddle3.quaternion', 'Right_middleFinger3', true, false, true),
new AnimationMapping('mixamorigRightHandThumb1.quaternion', 'Right_thumb0', true, false, true),
new AnimationMapping('mixamorigRightHandThumb2.quaternion', 'Right_thumb1', true, false, true),
new AnimationMapping('mixamorigRightHandThumb3.quaternion', 'Right_thumb2', true, false, true),
new AnimationMapping('mixamorigRightHandIndex1.quaternion', 'Right_indexFinger1', true, false, true),
new AnimationMapping('mixamorigRightHandIndex2.quaternion', 'Right_indexFinger2', true, false, true),
new AnimationMapping('mixamorigRightHandIndex3.quaternion', 'Right_indexFinger3', true, false, true),
new AnimationMapping('mixamorigRightHandRing1.quaternion', 'Right_ringFinger1', true, false, true),
new AnimationMapping('mixamorigRightHandRing2.quaternion', 'Right_ringFinger2', true, false, true),
new AnimationMapping('mixamorigRightHandRing3.quaternion', 'Right_ringFinger3', true, false, true),
new AnimationMapping('mixamorigRightHandPinky1.quaternion', 'Right_littleFinger1', true, false, true),
new AnimationMapping('mixamorigRightHandPinky2.quaternion', 'Right_littleFinger2', true, false, true),
new AnimationMapping('mixamorigRightHandPinky3.quaternion', 'Right_littleFinger3', true, false, true),

new AnimationMapping('mixamorigRightUpLeg.quaternion', 'Right_leg', false, false),
new AnimationMapping('mixamorigRightLeg.quaternion', 'Right_knee', false, false),
new AnimationMapping('mixamorigRightFoot.quaternion', 'Right_ankle', false, false),
new AnimationMapping('mixamorigRightToeBase.quaternion', 'Right_toe', false, false),
new AnimationMapping('mixamorigRightUpLeg.quaternion', 'Right_leg', false, false, false),
new AnimationMapping('mixamorigRightLeg.quaternion', 'Right_knee', false, false, false),
new AnimationMapping('mixamorigRightFoot.quaternion', 'Right_ankle', false, false, false),
new AnimationMapping('mixamorigRightToeBase.quaternion', 'Right_toe', false, false, false),

new AnimationMapping('mixamorigLeftUpLeg.quaternion', 'Left_leg', false, false),
new AnimationMapping('mixamorigLeftLeg.quaternion', 'Left_knee', false, false),
new AnimationMapping('mixamorigLeftFoot.quaternion', 'Left_ankle', false, false),
new AnimationMapping('mixamorigLeftToeBase.quaternion', 'Left_toe', false, false),
new AnimationMapping('mixamorigLeftUpLeg.quaternion', 'Left_leg', false, false, false),
new AnimationMapping('mixamorigLeftLeg.quaternion', 'Left_knee', false, false, false),
new AnimationMapping('mixamorigLeftFoot.quaternion', 'Left_ankle', false, false, false),
new AnimationMapping('mixamorigLeftToeBase.quaternion', 'Left_toe', false, false, false),
];
43 changes: 20 additions & 23 deletions avatars/animationHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,38 +997,35 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
animationTrackName: k,
dst,
// isTop,
isArm,
isPosition,
} = spec;

const aimAnimation = (avatar.aimAnimation && aimAnimations[avatar.aimAnimation]);
_handleDefault(spec);
const t2 = (avatar.aimTime / aimMaxTime) % aimAnimation.duration;
if (!isPosition) {
if (aimAnimation) {

const aimAnimation = (avatar.aimAnimation && aimAnimations[avatar.aimAnimation]);
if (aimAnimation) {
const t2 = (avatar.aimTime / aimMaxTime) % aimAnimation.duration;
const transitionFactor = Math.min(1, avatar.aimTime / 200);
if (!isPosition) {
const src2 = aimAnimation.interpolants[k];
const v2 = src2.evaluate(t2);
localQuaternion2.fromArray(v2);

const idleAnimation = _getIdleAnimation('walk');
const t3 = 0;
const src3 = idleAnimation.interpolants[k];
const v3 = src3.evaluate(t3);
if (isArm) {
dst.slerp(localQuaternion2, transitionFactor * 0.5);
} else {
const t = (0.5 - idleWalkFactor * 0.5) * transitionFactor;
dst.slerp(localQuaternion2, t);
}
} else {
const src2 = aimAnimation.interpolants[k];
const v2 = src2.evaluate(t2);
localVector2.fromArray(v2);
_clearXZ(localVector2, isPosition);

dst
.premultiply(localQuaternion2.fromArray(v3).invert())
.premultiply(localQuaternion2.fromArray(v2));
dst.lerp(localVector2, crouchFactor * transitionFactor);
}
} else {
const src2 = aimAnimation.interpolants[k];
const v2 = src2.evaluate(t2);

const idleAnimation = _getIdleAnimation('walk');
const t3 = 0;
const src3 = idleAnimation.interpolants[k];
const v3 = src3.evaluate(t3);

dst
.sub(localVector2.fromArray(v3))
.add(localVector2.fromArray(v2));
}
};
} else if (avatar.unuseAnimation && avatar.unuseTime >= 0) {
Expand Down
Binary file modified public/animations/animations.z
Binary file not shown.
Binary file modified public/animations/sword_side_slash.fbx
Binary file not shown.
Binary file modified public/animations/sword_side_slash_step.fbx
Binary file not shown.
Binary file modified public/animations/sword_topdown_slash.fbx
Binary file not shown.
Binary file modified public/animations/sword_topdown_slash_step.fbx
Binary file not shown.