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

Z targetswap #1

Open
wants to merge 43 commits into
base: zTargetingCombatPr
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2da5e44
Add new OOT sounds
May 22, 2022
32b7182
Add useLodder api
May 24, 2022
af6a2e8
ItemLoader -> CachedLoader rename
May 25, 2022
1d57c2f
Add SF Movie Poster ttf font
May 25, 2022
e0db718
Add numLods tracking to lod.js
May 25, 2022
e7fd238
Add SF Movie Poster to fonts
May 25, 2022
1e981b1
Rewrite voice endpoint voicer message preload
May 25, 2022
0f34a97
Update voice loading api in character controller
May 25, 2022
8a43645
Add localPlayer detached support
May 25, 2022
b9c0b59
Bugfix typo
May 25, 2022
7f453e5
Npc manager dead code cleanup
May 25, 2022
559b455
Pass through detached to LocalPlayer
May 25, 2022
40624d9
Rewrite character select ui
May 25, 2022
669cd1a
Npc manager clean up npcApp latching
May 25, 2022
c4c2765
Bump totum
May 25, 2022
6e198fe
Major npc manager refactoring
May 25, 2022
020aee1
Bump totum
May 25, 2022
eb9cd9a
Add OOT_Sword_Draw.wav
May 25, 2022
499ad69
Rebuild sounds
May 25, 2022
4ccb24e
Add more sounds mappings in sounds.js
May 25, 2022
45dd4da
Debugging code cleanup in character select
May 25, 2022
ffc0f40
hook remote lore
GitWillG May 25, 2022
937720e
created rudimentary z target swapping
GitWillG May 25, 2022
c148dbb
added notes for tomorrow
GitWillG May 25, 2022
4dc644a
created abstract handledown that accepts param
GitWillG May 26, 2022
edf4c88
functionality to find angle between ob and cam
GitWillG May 26, 2022
5a6cb1d
functionality to check if z-lock should be dropped
GitWillG May 26, 2022
7fb7c2a
checkDrop() no longer linked to button press
GitWillG May 27, 2022
ffd9b9a
minor commenting and refactoring
GitWillG May 27, 2022
648c5f4
Created method for selecting nearby mobs as targets
GitWillG May 27, 2022
f99f119
corrected metaverse components mob and npc
GitWillG May 28, 2022
e41fb37
corrected missing files
GitWillG May 28, 2022
49f4d36
seperated npc inter its own function for testing
GitWillG May 28, 2022
b11e2ac
angle dropping finished, npc-targeting disabled
GitWillG May 31, 2022
f30a87c
angle dropping finished, npc-targeting disabled
GitWillG May 31, 2022
5f93996
Merge branch 'z-targetSwap' into zTargetingCombatPr
GitWillG Jun 1, 2022
f208bdc
Merge pull request #1 from gonnavis/zTargetingCombatPr
GitWillG Jun 1, 2022
10934d1
Revert "Z targeting combat pr "
GitWillG Jun 1, 2022
9496377
Merge pull request #2 from GitWillG/revert-1-zTargetingCombatPr
GitWillG Jun 1, 2022
6fec39b
resolved issues with spawning NPCs
GitWillG Jun 3, 2022
af28613
scene addition
GitWillG Jun 3, 2022
50cc5d4
addition of test scenes
GitWillG Jun 3, 2022
d6e4449
finished swapping functionality, cleaned code
GitWillG Jun 7, 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
26 changes: 2 additions & 24 deletions ai/lore/lore-ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,13 @@ import {
defaultPlayerBio,
defaultObjectName,
defaultObjectDescription,

makeLorePrompt,
makeLoreStop,
postProcessResponse,
parseLoreResponses,

makeCommentPrompt,
makeCommentStop,
parseCommentResponse,

makeSelectTargetPrompt,
makeSelectTargetStop,
parseSelectTargetResponse,

makeSelectCharacterPrompt,
makeSelectCharacterStop,
parseSelectCharacterResponse,

makeChatPrompt,
makeChatStop,
parseChatResponse,

makeOptionsPrompt,
makeOptionsStop,
parseOptionsResponse,

makeCharacterIntroPrompt,
makeCharacterIntroStop,
parseCharacterIntroResponse,
postProcessResponse,
parseLoreResponses,
} from './lore-model.js'

const numGenerateTries = 5;
Expand Down
2 changes: 1 addition & 1 deletion ai/lore/lore-model.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'http://localhost/lib/webaverse_resource/lore/lore-model.js';
export * from 'https://webaverse.github.io/lore/lore-model.js';
111 changes: 55 additions & 56 deletions avatars/AnimationMapping.js
Original file line number Diff line number Diff line change
@@ -1,73 +1,72 @@
class AnimationMapping {
constructor(animationTrackName, boneName, isTop, isPosition, isArm) {
constructor(animationTrackName, boneName, isTop, isPosition) {
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, this.isArm);
return new AnimationMapping(this.animationTrackName, this.boneName, this.isTop, this.isPosition);
}
}

export const animationMappingConfig = [
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('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('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('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('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('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('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('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('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),
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),
];
47 changes: 23 additions & 24 deletions avatars/animationHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,13 @@ export const loadPromise = (async () => {
grab_right: {animation: animations.index['grab_right.fbx'], speedFactor: 1.2},
pick_up: {animation: animations.index['pick_up.fbx'], speedFactor: 1},
};
window.activateAnimations = activateAnimations;
narutoRunAnimations = {
narutoRun: animations.find(a => a.isNarutoRun),
};
window.narutoRunAnimations = narutoRunAnimations;
hurtAnimations = {
pain_back: animations.index['pain_back.fbx'],
pain_arch: animations.index['pain_arch.fbx'],
};
window.hurtAnimations = hurtAnimations;
holdAnimations = {
pick_up_idle: animations.index['pick_up_idle.fbx'],
};
Expand Down Expand Up @@ -694,7 +691,6 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
} else {
mirrorFactor = isBackward ? 1 : 0;
}
// if (avatar === window.localPlayer.avatar) console.log(window.logNum(angleFactor), window.logNum(mirrorFactor));
avatar.lastBackwardFactor = mirrorFactor;

if (avatar.emoteAnimation !== avatar.lastEmoteAnimation) {
Expand Down Expand Up @@ -1015,35 +1011,38 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
animationTrackName: k,
dst,
// isTop,
isArm,
isPosition,
} = spec;

_handleDefault(spec);

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) {
_handleDefault(spec);
const t2 = (avatar.aimTime / aimMaxTime) % aimAnimation.duration;
if (!isPosition) {
if (aimAnimation) {
const src2 = aimAnimation.interpolants[k];
const v2 = src2.evaluate(t2);
localQuaternion2.fromArray(v2);

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);
const idleAnimation = _getIdleAnimation('walk');
const t3 = 0;
const src3 = idleAnimation.interpolants[k];
const v3 = src3.evaluate(t3);

dst.lerp(localVector2, crouchFactor * transitionFactor);
dst
.premultiply(localQuaternion2.fromArray(v3).invert())
.premultiply(localQuaternion2.fromArray(v2));
}
} 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
Loading