Skip to content

Commit

Permalink
clean.
Browse files Browse the repository at this point in the history
  • Loading branch information
gonnavis committed Apr 9, 2022
1 parent d71e237 commit dfd9b22
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 193 deletions.
11 changes: 0 additions & 11 deletions app-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ class AppManager extends EventTarget {
const {trackedApp} = e.data;
const trackedAppJson = trackedApp.toJSON();
const {instanceId, contentId, position, quaternion, scale, components: componentsString} = trackedAppJson;
// if (contentId.indexOf('sword') >= 0) debugger;
// if (contentId.indexOf('bow') >= 0) debugger;
const components = JSON.parse(componentsString);

const p = makePromise();
Expand Down Expand Up @@ -246,8 +244,6 @@ class AppManager extends EventTarget {

// attempt to load app
try {
// if (contentId.indexOf('sword') >= 0) debugger;
// if (contentId.indexOf('bow') >= 0) debugger;
const m = await metaversefile.import(contentId);
if (!live) return _bailout(null);

Expand All @@ -265,8 +261,6 @@ class AppManager extends EventTarget {
app.lastMatrix.copy(app.matrixWorld);

// set components
// if (contentId.indexOf('sword') >= 0) debugger;
// if (contentId.indexOf('bow') >= 0) debugger;
app.instanceId = instanceId;
app.setComponent('physics', true);
for (const {key, value} of components) {
Expand All @@ -277,17 +271,12 @@ class AppManager extends EventTarget {
// initialize app
{
// console.log('add module', m);
// if (contentId.indexOf('sword') >= 0) debugger;
// if (contentId.indexOf('bow') >= 0) debugger;
const mesh = await app.addModule(m);
if (!live) return _bailout(app);
if (!mesh) {
console.warn('failed to load object', {contentId});
}

// if (contentId.indexOf('sword') >= 0) debugger;
// if (contentId.indexOf('bow') >= 0) debugger;

this.addApp(app);
}

Expand Down
2 changes: 1 addition & 1 deletion avatars/AnimationMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class AnimationMapping {
this.animationTrackName = animationTrackName;
this.boneName = boneName;
this.isTop = isTop;
this.isCombo = isCombo;
this.isCombo = isCombo; // arms with a little upper spines
this.isPosition = isPosition;
}

Expand Down
46 changes: 14 additions & 32 deletions avatars/animationHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Vector3, Quaternion, AnimationClip, DepthStencilFormat} from 'three';
import {Vector3, Quaternion, AnimationClip} from 'three';
import metaversefile from 'metaversefile';
import {VRMSpringBoneImporter, VRMLookAtApplyer, VRMCurveMapper} from '@pixiv/three-vrm/lib/three-vrm.module.js';
import easing from '../easing.js';
Expand Down Expand Up @@ -158,12 +158,6 @@ const animationsIdleArrays = {
run: {name: 'idle.fbx'},
crouch: {name: 'Crouch Idle.fbx'},
};
// {
// reset: {name: 'reset.fbx', animation: AnimationClip}
// walk: {name: 'idle.fbx', animation: AnimationClip}
// run: {name: 'idle.fbx', animation: AnimationClip}
// crouch: {name: 'Crouch Idle.fbx', animation: AnimationClip}
// }

const cubicBezier = easing(0, 1, 0, 1);

Expand Down Expand Up @@ -656,7 +650,7 @@ const _blendFly = spec => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
lerpFn,
} = spec;

Expand All @@ -679,7 +673,7 @@ const _blendActivateAction = spec => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
lerpFn,
} = spec;

Expand Down Expand Up @@ -792,7 +786,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
lerpFn,
isPosition,
} = spec;
Expand All @@ -805,7 +799,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
} = spec;

const t2 = activeAvatar.jumpTime / 1000 * 0.6 + 0.7;
Expand All @@ -820,7 +814,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
} = spec;

const sitAnimation = sitAnimations[activeAvatar.sitAnimation || defaultSitAnimation];
Expand All @@ -835,7 +829,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
isPosition,
} = spec;

Expand All @@ -856,7 +850,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
animationTrackName: k,
dst,
lerpFn,
isTop,
// isTop,
isPosition,
} = spec;

Expand Down Expand Up @@ -885,7 +879,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
} = spec;
const t2 = (activeAvatar.fallLoopTime/1000) ;
Expand All @@ -901,34 +895,29 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
activeAvatar.useAnimationEnvelope.length > 0
) {
return spec => {
debugger
const {
animationTrackName: k,
dst,
isTop,
// isTop,
isCombo,
isPosition,
} = spec;

// debugger
let useAnimation;
let t2;
const useTimeS = activeAvatar.useTime / 1000;
if (activeAvatar.useAnimation) {
const useAnimationName = activeAvatar.useAnimation;
// if (useAnimationName.indexOf('pistol') >= 0) debugger;
useAnimation = useAnimations[useAnimationName];
t2 = Math.min(useTimeS, useAnimation.duration);
} else if (activeAvatar.useAnimationCombo.length > 0) {
const useAnimationName = activeAvatar.useAnimationCombo[activeAvatar.useAnimationIndex];
// if (useAnimationName.indexOf('pistol') >= 0) debugger;
useAnimation = useAnimations[useAnimationName];
t2 = Math.min(useTimeS, useAnimation.duration);
} else if (activeAvatar.useAnimationEnvelope.length > 0) {
let totalTime = 0;
for (let i = 0; i < activeAvatar.useAnimationEnvelope.length - 1; i++) {
const animationName = activeAvatar.useAnimationEnvelope[i];
// if (animationName.indexOf('pistol') >= 0) debugger;
const animation = useAnimations[animationName];
totalTime += animation.duration;
}
Expand All @@ -937,7 +926,6 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
let animationTimeBase = 0;
for (let i = 0; i < activeAvatar.useAnimationEnvelope.length - 1; i++) {
const animationName = activeAvatar.useAnimationEnvelope[i];
// if (animationName.indexOf('pistol') >= 0) debugger;
const animation = useAnimations[animationName];
if (useTimeS < (animationTimeBase + animation.duration)) {
useAnimation = animation;
Expand All @@ -949,7 +937,6 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
t2 = Math.min(useTimeS - animationTimeBase, useAnimation.duration);
} else { // loop
const secondLastAnimationName = activeAvatar.useAnimationEnvelope[activeAvatar.useAnimationEnvelope.length - 2];
// if (secondLastAnimationName.indexOf('pistol') >= 0) debugger;
useAnimation = useAnimations[secondLastAnimationName];
t2 = (useTimeS - animationTimeBase) % useAnimation.duration;
}
Expand All @@ -960,7 +947,6 @@ export const _applyAnimation = (avatar, now, moveFactors) => {

if (useAnimation) {
if (!isPosition) {
debugger
const src2 = useAnimation.interpolants[k];
const v2 = src2.evaluate(t2);
localQuaternion2.fromArray(v2);
Expand Down Expand Up @@ -1024,12 +1010,11 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
}
};
} else if (activeAvatar.hurtAnimation) {
// debugger
return spec => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
isPosition,
} = spec;

Expand Down Expand Up @@ -1067,12 +1052,11 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
}
};
} else if (activeAvatar.aimAnimation) {
// debugger
return spec => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
isPosition,
} = spec;

Expand Down Expand Up @@ -1108,21 +1092,19 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
}
};
} else if (activeAvatar.unuseAnimation && activeAvatar.unuseTime >= 0) {
debugger
return spec => {
const {
animationTrackName: k,
dst,
lerpFn,
isTop,
// isTop,
isPosition,
} = spec;

_handleDefault(spec);

const unuseTimeS = activeAvatar.unuseTime / 1000;
const unuseAnimationName = activeAvatar.unuseAnimation;
// if (unuseAnimationName.indexOf('pistol') >= 0) debugger;
const unuseAnimation = useAnimations[unuseAnimationName];
const t2 = Math.min(unuseTimeS, unuseAnimation.duration);
const f = Math.min(Math.max(unuseTimeS / unuseAnimation.duration, 0), 1);
Expand Down Expand Up @@ -1181,7 +1163,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => {
const {
animationTrackName: k,
dst,
isTop,
// isTop,
isPosition,
} = spec;

Expand Down
26 changes: 0 additions & 26 deletions avatars/avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ const _makeDebugMesh = (avatar) => {

class Avatar {
constructor(object, options = {}) {
window.avatar = this;
if (!object) {
object = {};
}
Expand Down Expand Up @@ -783,7 +782,6 @@ class Avatar {
Left_toe: this.legsManager.leftLeg.toe,
Right_toe: this.legsManager.rightLeg.toe,
};
window.modelBoneOutputs = this.modelBoneOutputs;

this.debugMesh = null;

Expand Down Expand Up @@ -1823,30 +1821,6 @@ class Avatar {


_updateHmdPosition();
window.domInfo.innerHTML = `
<div>idleWalkFactor: --- ${moveFactors.idleWalkFactor.toFixed(2)}</div>
<div>walkRunFactor: --- ${moveFactors.walkRunFactor.toFixed(2)}</div>
<div>crouchFactor: --- ${moveFactors.crouchFactor.toFixed(2)}</div>
<div>chargeJumpState: --- ${this.chargeJumpState}</div>
<div>danceState: --- ${this.danceState}</div>
<div>fallLoopState: --- ${this.fallLoopState}</div>
<div>flyState: --- ${this.flyState}</div>
<div>jumpState: --- ${this.jumpState}</div>
<div>narutoRunState: --- ${this.narutoRunState}</div>
<div>sitState: --- ${this.sitState}</div>
<div>aimAnimation: --- ${this.aimAnimation}</div>
<div>danceAnimation: --- ${this.danceAnimation}</div>
<div>hurtAnimation: --- ${this.hurtAnimation}</div>
<div>poseAnimation: --- ${this.poseAnimation}</div>
<div>sitAnimation: --- ${this.sitAnimation}</div>
<div>useAnimation: --- ${this.useAnimation}</div>
<div>useAnimationCombo: --- ${this.useAnimationCombo}</div>
<div>useAnimationEnvelope: --- ${this.useAnimationEnvelope}</div>
<div>useAnimationIndex: --- ${this.useAnimationIndex}</div>
<div>useTime: --- ${Math.floor(this.useTime)}</div>
<div>unuseAnimation: --- ${this.unuseAnimation}</div>
<div>unuseTime: --- ${Math.floor(this.unuseTime)}</div>
`
_applyAnimation(this, now, moveFactors);

if (this.poseAnimation) {
Expand Down
4 changes: 0 additions & 4 deletions character-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1234,10 +1234,6 @@ class NpcPlayer extends StaticUninterpolatedPlayer {
super(opts);

this.isNpcPlayer = true;

if (!window.s) window.s = {};
if (!window.s.npcPlayers) window.s.npcPlayers = []
window.s.npcPlayers.push(this);
}
setAvatarApp(app) {
app.toggleBoneUpdates(true);
Expand Down
1 change: 0 additions & 1 deletion character-physics.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ class CharacterPhysics {
const renderer = getRenderer();
const session = renderer.xr.getSession();
const aimAction = this.player.getAction('aim');
// if (aimAction) debugger
const aimComponent = (() => {
for (const action of this.player.getActions()) {
if (action.type === 'wear') {
Expand Down
2 changes: 0 additions & 2 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ const _getNextUseIndex = animationCombo => {
}
}
const _startUse = () => {
// debugger
const localPlayer = metaversefileApi.useLocalPlayer();
const wearApp = loadoutManager.getSelectedApp();
if (wearApp) {
Expand Down Expand Up @@ -1152,7 +1151,6 @@ class GameManager extends EventTarget {
_mouseup();
}
menuAim() {
// debugger
const localPlayer = metaversefileApi.useLocalPlayer();
if (!localPlayer.hasAction('aim')) {
const localPlayer = metaversefileApi.useLocalPlayer();
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<body>
<div id=iframe-container></div>
<div id="root"></div>
<div id="domInfo" style="position: fixed; left: 0; top: 100px; background: rgba(0,0,0,.5); color: white; padding: 5px; width: 350px; pointer-events: none;"></div>
<script type=module src="/pre.js"></script>
<script type=module src="/src/main.jsx"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const _proxyUrl = (req, res, u) => {
});

const isHttps = !process.env.HTTP_ONLY && (!!certs.key && !!certs.cert);
const port = parseInt(process.env.PORT, 10) || (isProduction ? 443 : 4000);
const port = parseInt(process.env.PORT, 10) || (isProduction ? 443 : 3000);
const wsPort = port + 1;

const _makeHttpServer = () => isHttps ? https.createServer(certs, app) : http.createServer(app);
Expand Down
29 changes: 0 additions & 29 deletions scenes/test.scn

This file was deleted.

Loading

0 comments on commit dfd9b22

Please sign in to comment.