From 939d70f0408eb6de636ce41bb2be31bad89d8fab Mon Sep 17 00:00:00 2001 From: gonnavis Date: Sat, 9 Apr 2022 17:50:21 +0800 Subject: [PATCH] clean. --- app-manager.js | 11 ------ avatars/AnimationMapping.js | 2 +- avatars/animationHelpers.js | 65 +++++++------------------------ avatars/avatars.js | 26 ------------- character-controller.js | 4 -- character-physics.js | 1 - game.js | 2 - index.html | 1 - index.mjs | 2 +- scenes/test.scn | 29 -------------- scenes/treehouse-simple.scn | 76 ------------------------------------- webaverse.js | 9 ----- 12 files changed, 16 insertions(+), 212 deletions(-) delete mode 100644 scenes/test.scn delete mode 100644 scenes/treehouse-simple.scn diff --git a/app-manager.js b/app-manager.js index 2ce6a7c414..9f70a7fd6c 100644 --- a/app-manager.js +++ b/app-manager.js @@ -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(); @@ -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); @@ -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) { @@ -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); } diff --git a/avatars/AnimationMapping.js b/avatars/AnimationMapping.js index cf978c66e6..b7ca407e27 100644 --- a/avatars/AnimationMapping.js +++ b/avatars/AnimationMapping.js @@ -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; } diff --git a/avatars/animationHelpers.js b/avatars/animationHelpers.js index 6d2a38e957..41167724ef 100644 --- a/avatars/animationHelpers.js +++ b/avatars/animationHelpers.js @@ -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'; @@ -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); @@ -656,7 +650,7 @@ const _blendFly = spec => { const { animationTrackName: k, dst, - isTop, + // isTop, lerpFn, } = spec; @@ -679,7 +673,7 @@ const _blendActivateAction = spec => { const { animationTrackName: k, dst, - isTop, + // isTop, lerpFn, } = spec; @@ -792,7 +786,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => { const { animationTrackName: k, dst, - isTop, + // isTop, lerpFn, isPosition, } = spec; @@ -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; @@ -820,7 +814,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => { const { animationTrackName: k, dst, - isTop, + // isTop, } = spec; const sitAnimation = sitAnimations[activeAvatar.sitAnimation || defaultSitAnimation]; @@ -835,7 +829,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => { const { animationTrackName: k, dst, - isTop, + // isTop, isPosition, } = spec; @@ -856,7 +850,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => { animationTrackName: k, dst, lerpFn, - isTop, + // isTop, isPosition, } = spec; @@ -885,7 +879,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => { const { animationTrackName: k, dst, - isTop, + // isTop, } = spec; const t2 = (activeAvatar.fallLoopTime/1000) ; @@ -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; } @@ -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; @@ -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; } @@ -960,20 +947,10 @@ export const _applyAnimation = (avatar, now, moveFactors) => { if (useAnimation) { if (!isPosition) { - debugger const src2 = useAnimation.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); - - // dst - // .premultiply(localQuaternion2.fromArray(v3).invert()) - // .premultiply(localQuaternion2.fromArray(v2)); - if (moveFactors.crouchFactor === 0) { if (isCombo) { // do nothing: localQuaternion2 already pure combo animation @@ -995,16 +972,6 @@ export const _applyAnimation = (avatar, now, moveFactors) => { localVector2.fromArray(v2); _clearXZ(localVector2, isPosition); - // const idleAnimation = _getIdleAnimation('walk'); - // const t3 = 0; - // const src3 = idleAnimation.interpolants[k]; - // const v3 = src3.evaluate(t3); - // localVector3.fromArray(v3); - - // dst - // .sub(localVector3) - // .add(localVector2); - if (moveFactors.crouchFactor === 0) { if (isCombo) { // do nothing: localVector2 already pure combo animation @@ -1024,12 +991,11 @@ export const _applyAnimation = (avatar, now, moveFactors) => { } }; } else if (activeAvatar.hurtAnimation) { - // debugger return spec => { const { animationTrackName: k, dst, - isTop, + // isTop, isPosition, } = spec; @@ -1067,12 +1033,11 @@ export const _applyAnimation = (avatar, now, moveFactors) => { } }; } else if (activeAvatar.aimAnimation) { - // debugger return spec => { const { animationTrackName: k, dst, - isTop, + // isTop, isPosition, } = spec; @@ -1108,13 +1073,12 @@ 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; @@ -1122,7 +1086,6 @@ export const _applyAnimation = (avatar, now, moveFactors) => { 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); @@ -1181,7 +1144,7 @@ export const _applyAnimation = (avatar, now, moveFactors) => { const { animationTrackName: k, dst, - isTop, + // isTop, isPosition, } = spec; diff --git a/avatars/avatars.js b/avatars/avatars.js index 21b6e5c8ee..5b7896fcba 100644 --- a/avatars/avatars.js +++ b/avatars/avatars.js @@ -398,7 +398,6 @@ const _makeDebugMesh = (avatar) => { class Avatar { constructor(object, options = {}) { - window.avatar = this; if (!object) { object = {}; } @@ -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; @@ -1823,30 +1821,6 @@ class Avatar { _updateHmdPosition(); - window.domInfo.innerHTML = ` -
idleWalkFactor: --- ${moveFactors.idleWalkFactor.toFixed(2)}
-
walkRunFactor: --- ${moveFactors.walkRunFactor.toFixed(2)}
-
crouchFactor: --- ${moveFactors.crouchFactor.toFixed(2)}
-
chargeJumpState: --- ${this.chargeJumpState}
-
danceState: --- ${this.danceState}
-
fallLoopState: --- ${this.fallLoopState}
-
flyState: --- ${this.flyState}
-
jumpState: --- ${this.jumpState}
-
narutoRunState: --- ${this.narutoRunState}
-
sitState: --- ${this.sitState}
-
aimAnimation: --- ${this.aimAnimation}
-
danceAnimation: --- ${this.danceAnimation}
-
hurtAnimation: --- ${this.hurtAnimation}
-
poseAnimation: --- ${this.poseAnimation}
-
sitAnimation: --- ${this.sitAnimation}
-
useAnimation: --- ${this.useAnimation}
-
useAnimationCombo: --- ${this.useAnimationCombo}
-
useAnimationEnvelope: --- ${this.useAnimationEnvelope}
-
useAnimationIndex: --- ${this.useAnimationIndex}
-
useTime: --- ${Math.floor(this.useTime)}
-
unuseAnimation: --- ${this.unuseAnimation}
-
unuseTime: --- ${Math.floor(this.unuseTime)}
- ` _applyAnimation(this, now, moveFactors); if (this.poseAnimation) { diff --git a/character-controller.js b/character-controller.js index 094a227c2a..47ca67c5c9 100644 --- a/character-controller.js +++ b/character-controller.js @@ -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); diff --git a/character-physics.js b/character-physics.js index 61da1c206e..f725b118aa 100644 --- a/character-physics.js +++ b/character-physics.js @@ -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') { diff --git a/game.js b/game.js index 54f2b50b67..4d13117e81 100644 --- a/game.js +++ b/game.js @@ -325,7 +325,6 @@ const _getNextUseIndex = animationCombo => { } } const _startUse = () => { - // debugger const localPlayer = metaversefileApi.useLocalPlayer(); const wearApp = loadoutManager.getSelectedApp(); if (wearApp) { @@ -1152,7 +1151,6 @@ class GameManager extends EventTarget { _mouseup(); } menuAim() { - // debugger const localPlayer = metaversefileApi.useLocalPlayer(); if (!localPlayer.hasAction('aim')) { const localPlayer = metaversefileApi.useLocalPlayer(); diff --git a/index.html b/index.html index fde623656d..6a44166b8d 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,6 @@
-
diff --git a/index.mjs b/index.mjs index db050989bb..bdba499510 100644 --- a/index.mjs +++ b/index.mjs @@ -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); diff --git a/scenes/test.scn b/scenes/test.scn deleted file mode 100644 index cc68766c88..0000000000 --- a/scenes/test.scn +++ /dev/null @@ -1,29 +0,0 @@ -{ - "objects": [ - { - "type": "application/light", - "content": { - "lightType": "ambient", - "args": [[255, 255, 255], 2] - } - }, - { - "type": "application/light", - "content": { - "lightType": "directional", - "args": [[255, 255, 255], 2], - "position": [1, 2, 3] - } - }, - { - "position": [ 0, 0, 0 ], - "start_url": "http://localhost/lib/webaverse_resource/street/index.js" - }, - { "position": [ 0, 1, -5 ], "start_url": "http://localhost/lib/webaverse_resource/bow/" }, - { "position": [ 1.5, 1, -5 ], "start_url": "http://localhost/lib/webaverse_resource/pistol/" }, - { "position": [ 3, 1, -5 ], "start_url": "http://localhost/lib/webaverse_resource/rifle/" }, - { "position": [ 5, 0, 0 ], "start_url": "http://localhost/lib/webaverse_resource/ramp/index.js" }, - { "position": [-1.5, 1, -5], "quaternion": [0, 0.7071067811865475, 0, 0.7071067811865476], "start_url": "http://localhost/lib/webaverse_resource/sword/" }, - { "position": [-3, 1, -5], "quaternion": [0, 0.7071067811865475, 0, 0.7071067811865476], "start_url": "http://localhost/lib/webaverse_resource/silsword/" } - ] -} diff --git a/scenes/treehouse-simple.scn b/scenes/treehouse-simple.scn deleted file mode 100644 index bee3d866c0..0000000000 --- a/scenes/treehouse-simple.scn +++ /dev/null @@ -1,76 +0,0 @@ -{ - "objects": [ - { - "type": "application/light", - "content": { - "lightType": "ambient", - "args": [[255, 255, 255], 2] - } - }, - { - "type": "application/light", - "content": { - "lightType": "directional", - "args": [[255, 255, 255], 2], - "position": [1, 2, 3] - } - }, - { - "position": [ 0, 0, 0 ], - "start_url": "http://localhost/lib/webaverse_resource/street/index.js" - }, - { - "position": [ - 0, - 5, - -5 - ], - "quaternion": [ - 0, - 0, - 0, - 1 - ], - "start_url": "/avatars/drake_hacker_v3_vian.vrm", - "components": [ - { - "key": "npc", - "value": { - "name": "Drake", - "voice": "Shining Armor", - "bio": "His nickname is DRK. 15/M hacker. Loves guns. Likes plotting new hacks. He has the best equipment and is always ready for a fight." - } - } - ] - }, - { - "position": [ - 2, - 5, - -5 - ], - "quaternion": [ - 0, - 0, - 0, - 1 - ], - "start_url": "/avatars/drake_hacker_v3_vian.vrm", - "components": [ - { - "key": "npc", - "value": { - "name": "Drake", - "voice": "Shining Armor", - "bio": "His nickname is DRK. 15/M hacker. Loves guns. Likes plotting new hacks. He has the best equipment and is always ready for a fight." - } - } - ] - }, - { - "position": [-2, 1, 1], - "quaternion": [0, 0.7071067811865475, 0, 0.7071067811865476], - "start_url": "http://localhost/lib/webaverse_resource/sword/" - } - ] -} diff --git a/webaverse.js b/webaverse.js index a841816b5a..0ba2e4ba39 100644 --- a/webaverse.js +++ b/webaverse.js @@ -364,15 +364,6 @@ const _startHacks = webaverse => { const localPlayer = metaversefileApi.useLocalPlayer(); const vpdAnimations = Avatar.getAnimations().filter(animation => animation.name.endsWith('.vpd')); - if (!window.s) window.s = {}; - window.s.localPlayer = localPlayer; - window.s.THREE = THREE; - window.s.physicsManager = physicsManager; - window.s.physx = physx; - window.s.metaversefileApi = metaversefileApi; - window.s.rootScene = rootScene; - window.s.loadoutManager = loadoutManager; - // let playerDiorama = null; const lastEmoteKey = { key: -1,