diff --git a/avatars/avatars.js b/avatars/avatars.js index 87128d6606..8dce1ce461 100644 --- a/avatars/avatars.js +++ b/avatars/avatars.js @@ -2213,7 +2213,7 @@ class Avatar { const _lowercase = s => s.slice(0, 1).toLowerCase() + s.slice(1); if (this.poseTracking) { - for (const k in this.poseTracking) { + /* for (const k in this.poseTracking) { if (!['Hips'].includes(k)) { // if (!/hand/i.test(k)) { const v = this.poseTracking[k]; @@ -2225,11 +2225,6 @@ class Avatar { } let k2 = k; - /* if (/left/i.test(k)) { - k2 = k2.replace(/left/gi, 'Right'); - } else if (/right/i.test(k)) { - k2 = k2.replace(/right/gi, 'Left'); - } */ const k3 = _lowercase(k2); // console.log('got k', k, k2, k3); @@ -2246,7 +2241,11 @@ class Avatar { } // } } - // this.modelBoneOutputs.Hips.quaternion.identity().premultiply(y180Quaternion); + // this.modelBoneOutputs.Hips.quaternion.identity().premultiply(y180Quaternion); */ + + for (const k in this.poseTracking) { + this.modelBoneOutputs[k].quaternion.copy(this.poseTracking[k].quaternion); + } } for (let i = 0; i < 2; i++) { const hand = this.handTracking[i]; @@ -2267,7 +2266,7 @@ class Avatar { this.modelBoneOutputsByVrm[k3].quaternion .setFromEuler(localEuler) - if (/wrist/i.test(k)) { + /* if (/wrist/i.test(k)) { this.modelBoneOutputsByVrm[k3].quaternion // .premultiply(x180Quaternion) // .premultiply(/left/i.test(k) ? leftRotation : rightRotation) @@ -2276,7 +2275,7 @@ class Avatar { // .premultiply(y180Quaternion) // .multiply(y180Quaternion) // .multiply(this.modelBoneOutputsByVrm[k3].initialQuaternion); - } + } */ } } } diff --git a/face-tracking.js b/face-tracking.js index 880213968b..6336ac1dcb 100644 --- a/face-tracking.js +++ b/face-tracking.js @@ -30,9 +30,11 @@ const points = { left: [468, 469, 470, 471, 472], }, }; -const y180Quaternion = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI); +// const y180Quaternion = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), Math.PI); +const slightLeftRotation = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), -Math.PI*0.1); +const rollRightRotation = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), -Math.PI*0.5); -window.clamp = (v, min, max) => Math.min(Math.max(v, min), max); +// window.clamp = (v, min, max) => Math.min(Math.max(v, min), max); let canvas = null; let overlayCanvas = null; @@ -78,6 +80,519 @@ let videoEl = null; fitCameraToBox(camera, boundingBox); }; */ +const _makeFakeAvatar = () => { + const Root = new THREE.Object3D(); + const Hips = new THREE.Object3D(); + const Spine = new THREE.Object3D(); + const Chest = new THREE.Object3D(); + const UpperChest = new THREE.Object3D(); + + const Neck = new THREE.Object3D(); + const Head = new THREE.Object3D(); + const Eye_L = new THREE.Object3D(); + const Eye_R = new THREE.Object3D(); + + const Left_shoulder = new THREE.Object3D(); + const Left_elbow = new THREE.Object3D(); + const Left_arm = new THREE.Object3D(); + const Left_wrist = new THREE.Object3D(); + const Left_thumb0 = new THREE.Object3D(); + const Left_thumb1 = new THREE.Object3D(); + const Left_thumb2 = new THREE.Object3D(); + const Left_indexFinger1 = new THREE.Object3D(); + const Left_indexFinger2 = new THREE.Object3D(); + const Left_indexFinger3 = new THREE.Object3D(); + const Left_middleFinger1 = new THREE.Object3D(); + const Left_middleFinger2 = new THREE.Object3D(); + const Left_middleFinger3 = new THREE.Object3D(); + const Left_ringFinger1 = new THREE.Object3D(); + const Left_ringFinger2 = new THREE.Object3D(); + const Left_ringFinger3 = new THREE.Object3D(); + const Left_littleFinger1 = new THREE.Object3D(); + const Left_littleFinger2 = new THREE.Object3D(); + const Left_littleFinger3 = new THREE.Object3D(); + + const Left_leg = new THREE.Object3D(); + const Left_knee = new THREE.Object3D(); + const Left_ankle = new THREE.Object3D(); + const Left_toe = new THREE.Object3D(); + + const Right_shoulder = new THREE.Object3D(); + const Right_elbow = new THREE.Object3D(); + const Right_arm = new THREE.Object3D(); + const Right_wrist = new THREE.Object3D(); + const Right_thumb0 = new THREE.Object3D(); + const Right_thumb1 = new THREE.Object3D(); + const Right_thumb2 = new THREE.Object3D(); + const Right_indexFinger1 = new THREE.Object3D(); + const Right_indexFinger2 = new THREE.Object3D(); + const Right_indexFinger3 = new THREE.Object3D(); + const Right_middleFinger1 = new THREE.Object3D(); + const Right_middleFinger2 = new THREE.Object3D(); + const Right_middleFinger3 = new THREE.Object3D(); + const Right_ringFinger1 = new THREE.Object3D(); + const Right_ringFinger2 = new THREE.Object3D(); + const Right_ringFinger3 = new THREE.Object3D(); + const Right_littleFinger1 = new THREE.Object3D(); + const Right_littleFinger2 = new THREE.Object3D(); + const Right_littleFinger3 = new THREE.Object3D(); + + const Right_leg = new THREE.Object3D(); + const Right_knee = new THREE.Object3D(); + const Right_ankle = new THREE.Object3D(); + const Right_toe = new THREE.Object3D(); + + Root.add(Hips); + Hips.add(Spine); + Spine.add(Chest); + Chest.add(UpperChest); + + UpperChest.add(Neck); + Neck.add(Head); + Head.add(Eye_L); + Head.add(Eye_R); + + UpperChest.add(Left_shoulder); + Left_shoulder.add(Left_arm); + Left_arm.add(Left_elbow); + Left_elbow.add(Left_wrist); + + Left_wrist.add(Left_thumb0); + Left_thumb0.add(Left_thumb1); + Left_thumb1.add(Left_thumb2); + + Left_wrist.add(Left_indexFinger1); + Left_indexFinger1.add(Left_indexFinger2); + Left_indexFinger2.add(Left_indexFinger3); + + Left_wrist.add(Left_middleFinger1); + Left_middleFinger1.add(Left_middleFinger2); + Left_middleFinger2.add(Left_middleFinger3); + + Left_wrist.add(Left_ringFinger1); + Left_ringFinger1.add(Left_ringFinger2); + Left_ringFinger2.add(Left_ringFinger3); + + Left_wrist.add(Left_littleFinger1); + Left_littleFinger1.add(Left_littleFinger2); + Left_littleFinger2.add(Left_littleFinger3); + + Hips.add(Left_leg); + Left_leg.add(Left_knee); + Left_knee.add(Left_ankle); + Left_ankle.add(Left_toe); + + UpperChest.add(Right_shoulder); + Right_shoulder.add(Right_arm); + Right_arm.add(Right_elbow); + Right_elbow.add(Right_wrist); + + Right_wrist.add(Right_thumb0); + Right_thumb0.add(Right_thumb1); + Right_thumb1.add(Right_thumb2); + + Right_wrist.add(Right_indexFinger1); + Right_indexFinger1.add(Right_indexFinger2); + Right_indexFinger2.add(Right_indexFinger3); + + Right_wrist.add(Right_middleFinger1); + Right_middleFinger1.add(Right_middleFinger2); + Right_middleFinger2.add(Right_middleFinger3); + + Right_wrist.add(Right_ringFinger1); + Right_ringFinger1.add(Right_ringFinger2); + Right_ringFinger2.add(Right_ringFinger3); + + Right_wrist.add(Right_littleFinger1); + Right_littleFinger1.add(Right_littleFinger2); + Right_littleFinger2.add(Right_littleFinger3); + + Hips.add(Right_leg); + Right_leg.add(Right_knee); + Right_knee.add(Right_ankle); + Right_ankle.add(Right_toe); + + return { + Root, + + Hips, + Spine, + Chest, + UpperChest, + Neck, + Head, + Eye_L, + Eye_R, + + Left_shoulder, + Left_arm, + Left_elbow, + Left_wrist, + Left_thumb2, + Left_thumb1, + Left_thumb0, + Left_indexFinger3, + Left_indexFinger2, + Left_indexFinger1, + Left_middleFinger3, + Left_middleFinger2, + Left_middleFinger1, + Left_ringFinger3, + Left_ringFinger2, + Left_ringFinger1, + Left_littleFinger3, + Left_littleFinger2, + Left_littleFinger1, + Left_leg, + Left_knee, + Left_ankle, + + Right_shoulder, + Right_arm, + Right_elbow, + Right_wrist, + Right_thumb2, + Right_thumb1, + Right_thumb0, + Right_indexFinger3, + Right_indexFinger2, + Right_indexFinger1, + Right_middleFinger3, + Right_middleFinger2, + Right_middleFinger1, + Right_ringFinger3, + Right_ringFinger2, + Right_ringFinger1, + Right_littleFinger3, + Right_littleFinger2, + Right_littleFinger1, + Right_leg, + Right_knee, + Right_ankle, + Left_toe, + Right_toe, + }; +}; +const localVector = new THREE.Vector3(); +const localVector2 = new THREE.Vector3(); +const localVector3 = new THREE.Vector3(); +const localVector4 = new THREE.Vector3(); +const localVector5 = new THREE.Vector3(); +const localVector6 = new THREE.Vector3(); +const localVector7 = new THREE.Vector3(); +const localVector8 = new THREE.Vector3(); +const localVector9 = new THREE.Vector3(); +const localTriangle = new THREE.Triangle(); +const localMatrix = new THREE.Matrix4(); +const zeroVector = new THREE.Vector3(); +/* const _retargetAnimation = (srcAnimation, srcBaseModel, dstBaseModel) => { + const srcModelBones = getModelBones(srcBaseModel); + const dstModelBones = getModelBones(dstBaseModel); + + // console.log('retarget', srcAnimation, srcModelBones, dstModelBones); // XXX + + const dstAnimation = srcAnimation.clone(); + + const numFrames = srcAnimation.interpolants['mixamorigHead.quaternion'].sampleValues.length / 4; + for (let frame = 0; frame < numFrames; frame++) { + const srcModelBones2 = cloneModelBones(srcModelBones); + const dstModelBones2 = cloneModelBones(dstModelBones); + srcModelBones2.Root.updateMatrixWorld(); + dstModelBones2.Root.updateMatrixWorld(); + + _setSkeletonToAnimationFrame(srcModelBones2, srcAnimation, frame); + _setSkeletonWorld(dstModelBones2, srcModelBones2); + _setAnimationFrameToSkeleton(dstAnimation, frame, dstModelBones2); + } + + decorateAnimation(dstAnimation); + + return dstAnimation; +}; */ +const _setSkeletonWorld = (() => { + const localVector = new THREE.Vector3(); + const localVector2 = new THREE.Vector3(); + const localVector3 = new THREE.Vector3(); + const localVector4 = new THREE.Vector3(); + const localQuaternion = new THREE.Quaternion(); + const localQuaternion2 = new THREE.Quaternion(); + const localMatrix2 = new THREE.Matrix4(); + return (dstModelBones, srcModelBones, srcModelBonesWhitelist) => { + const srcBoneToModelNameMap = new Map(); + for (const k in srcModelBones) { + srcBoneToModelNameMap.set(srcModelBones[k], k); + } + + const _recurse = (srcModelBone, dstModelBone) => { + if (srcModelBonesWhitelist.indexOf(srcModelBone) !== -1) { + // srcModelBone.matrixWorld.decompose(localVector, localQuaternion, localVector2); + localQuaternion.copy(srcModelBone.quaternion); + // console.log('got hips', localQuaternion.toArray().join(',')); + dstModelBone.matrixWorld.decompose(localVector3, localQuaternion2, localVector4); + + // localQuaternion.premultiply(downRotation); + + dstModelBone.matrixWorld.compose( + srcModelBone === srcModelBones.Hips ? srcModelBone.position : localVector3, + localQuaternion, + localVector4 + ); + dstModelBone.matrix.copy(dstModelBone.matrixWorld) + .premultiply(localMatrix2.copy(dstModelBone.parent.matrixWorld).invert()) + .decompose(dstModelBone.position, dstModelBone.quaternion, dstModelBone.scale); + // dstModelBone.quaternion.premultiply(dstModelBone.initialQuaternion); + dstModelBone.updateMatrixWorld(); + } + + for (let i = 0; i < srcModelBone.children.length; i++) { + const srcChild = srcModelBone.children[i]; + const modelBoneName = srcBoneToModelNameMap.get(srcChild); + if (modelBoneName) { + const dstChild = dstModelBones[modelBoneName]; + if (dstChild) { + _recurse(srcChild, dstChild); + } + } + } + }; + _recurse(srcModelBones.Root, dstModelBones.Root); + }; +})(); +const _solvePoseToAvatar = (() => { + const tempAvatar = _makeFakeAvatar(); + const boneBuffers = { + leftHip: new THREE.Vector3(), + rightHip: new THREE.Vector3(), + leftShoulder: new THREE.Vector3(), + rightShoulder: new THREE.Vector3(), + leftElbow: new THREE.Vector3(), + rightElbow: new THREE.Vector3(), + leftHand: new THREE.Vector3(), + rightHand: new THREE.Vector3(), + leftPinky: new THREE.Vector3(), + rightPinky: new THREE.Vector3(), + leftIndex: new THREE.Vector3(), + rightIndex: new THREE.Vector3(), + leftThumb: new THREE.Vector3(), + rightThumb: new THREE.Vector3(), + }; + + return (lm3d, leftHandLm, rightHandLm, avatar) => { + boneBuffers.leftHip.copy(lm3d[23]); + boneBuffers.rightHip.copy(lm3d[24]); + boneBuffers.leftShoulder.copy(lm3d[11]); + boneBuffers.rightShoulder.copy(lm3d[12]); + boneBuffers.leftElbow.copy(lm3d[13]); + boneBuffers.rightElbow.copy(lm3d[14]); + boneBuffers.leftHand.copy(lm3d[15]); + boneBuffers.rightHand.copy(lm3d[16]); + boneBuffers.leftPinky.copy(lm3d[17]); + boneBuffers.rightPinky.copy(lm3d[18]); + boneBuffers.leftIndex.copy(lm3d[19]); + boneBuffers.rightIndex.copy(lm3d[20]); + boneBuffers.leftThumb.copy(lm3d[21]); + boneBuffers.rightThumb.copy(lm3d[22]); + + for (const k in boneBuffers) { + // boneBuffers[k].x *= -1; + boneBuffers[k].y *= -1; + boneBuffers[k].z *= -1; + } + + /* window.lm3d = lm3d; + window.leftHip = leftHip; + window.rightHip = rightHip; + window.leftShoulder = leftShoulder; + window.rightShoulder = rightShoulder; */ + + const bodyCenter = localVector.copy(boneBuffers.leftHip) + .add(boneBuffers.rightHip) + .add(boneBuffers.leftShoulder) + .add(boneBuffers.rightShoulder) + .divideScalar(4); + + const leftMiddle = localVector2.copy(boneBuffers.leftPinky) + .add(boneBuffers.leftIndex) + .divideScalar(2); + + const rightMiddle = localVector3.copy(boneBuffers.rightPinky) + .add(boneBuffers.rightIndex) + .divideScalar(2); + + let leftWristNormal; + if (leftHandLm) { + localTriangle.a.copy(leftHandLm[0]); + localTriangle.b.copy(leftHandLm[5]); + localTriangle.c.copy(leftHandLm[17]); + [ + localTriangle.a, + localTriangle.b, + localTriangle.c, + ].forEach(v => { + v.x *= -1; + }); + leftWristNormal = localTriangle.getNormal(localVector4); + } else { + localTriangle.a.copy(boneBuffers.leftIndex); + localTriangle.b.copy(boneBuffers.leftPinky); + localTriangle.c.copy(boneBuffers.leftThumb); + leftWristNormal = localTriangle.getNormal(localVector4); + } + /* window.lol = [ + boneBuffers.leftIndex.toArray().join(', '), + boneBuffers.leftPinky.toArray().join(', '), + boneBuffers.leftThumb.toArray().join(', '), + leftWristNormal.toArray().join(', '), + ]; */ + + let rightWristNormal; + if (rightHandLm) { + localTriangle.a.copy(rightHandLm[0]); + localTriangle.b.copy(rightHandLm[17]); + localTriangle.c.copy(rightHandLm[5]); + [ + localTriangle.a, + localTriangle.b, + localTriangle.c, + ].forEach(v => { + v.x *= -1; + }); + rightWristNormal = localTriangle.getNormal(localVector5); + } else { + localTriangle.a.copy(boneBuffers.rightPinky); + localTriangle.b.copy(boneBuffers.rightIndex); + localTriangle.c.copy(boneBuffers.rightHand); + rightWristNormal = localTriangle.getNormal(localVector5); + } + + /* avatar.Root.updateMatrixWorld(); + const q = avatar.Left_arm.getWorldQuaternion(new THREE.Quaternion()); + console.log('got q', q); + debugger; */ + + /* const topHip = localVector6.copy(boneBuffers.leftHip) + .add(boneBuffers.rightHip) + .divideScalar(2) + .add(localVector7.set(0, Math.max(boneBuffers.leftHip.y, boneBuffers.rightHip.y) + 0.1, 0)); */ + + /* const topShoulder = localVector7.copy(boneBuffers.leftShoulder) + .add(boneBuffers.rightShoulder) + .divideScalar(2) + .add(localVector8.set(0, 0.1, 0)); */ + + { + localTriangle.a.copy(bodyCenter); + localTriangle.b.copy(boneBuffers.leftHip); + localTriangle.c.copy(boneBuffers.rightHip); + const hipsDirection = localTriangle.getNormal(localVector8); + // hipsDirection.x *= -1; + tempAvatar.Hips.quaternion.setFromRotationMatrix( + localMatrix.lookAt( + zeroVector, + hipsDirection, + localVector9.set(0, 1, 0) + ) + ) + .premultiply(slightLeftRotation); + // console.log('set hips', tempAvatar.Hips.quaternion.toArray().join(',')); + } + { + tempAvatar.Left_arm.quaternion.setFromUnitVectors( + new THREE.Vector3(1, 0, 0), + boneBuffers.leftElbow.clone().sub(boneBuffers.leftShoulder).normalize(), + localVector9.set(0, 1, 0) + ) + // .multiply(avatar.Left_shoulder.initialQuaternion) + // .premultiply(rollRightRotation) + // .premultiply(slightLeftRotation); + // console.log('set hips', tempAvatar.Hips.quaternion.toArray().join(',')); + // window.lol = [boneBuffers.leftShoulder, boneBuffers.leftElbow]; + } + { + tempAvatar.Right_arm.quaternion.setFromUnitVectors( + new THREE.Vector3(-1, 0, 0), + boneBuffers.rightElbow.clone().sub(boneBuffers.rightShoulder).normalize(), + localVector9.set(0, 1, 0) + ) + // .multiply(avatar.Left_shoulder.initialQuaternion) + // .premultiply(rollRightRotation) + // .premultiply(slightLeftRotation); + // console.log('set hips', tempAvatar.Hips.quaternion.toArray().join(',')); + // window.lol = [boneBuffers.leftShoulder, boneBuffers.leftElbow]; + } + // window.initialQuaternion = avatar.Left_shoulder.initialQuaternion; + { + tempAvatar.Left_elbow.quaternion.setFromUnitVectors( + new THREE.Vector3(1, 0, 0), + boneBuffers.leftHand.clone().sub(boneBuffers.leftElbow).normalize(), + localVector9.set(0, 1, 0) + ) + // .multiply(avatar.Left_elbow.initialQuaternion) + // .premultiply(slightLeftRotation); + // console.log('set hips', tempAvatar.Hips.quaternion.toArray().join(',')); + } + { + tempAvatar.Right_elbow.quaternion.setFromUnitVectors( + new THREE.Vector3(-1, 0, 0), + boneBuffers.rightHand.clone().sub(boneBuffers.rightElbow).normalize(), + localVector9.set(0, 1, 0) + ) + // .multiply(avatar.Left_wrist.initialQuaternion) + // .premultiply(slightLeftRotation); + // console.log('set hips', tempAvatar.Hips.quaternion.toArray().join(',')); + } + { + tempAvatar.Left_wrist.quaternion.setFromRotationMatrix( + localMatrix.lookAt( + boneBuffers.leftHand, + leftMiddle, + leftWristNormal + ) + ) + // .premultiply(slightLeftRotation); + // .multiply(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), -Math.PI*0.5)) + // .multiply(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), Math.PI)) + } + { + tempAvatar.Right_wrist.quaternion.setFromRotationMatrix( + localMatrix.lookAt( + boneBuffers.rightHand, + rightMiddle, + rightWristNormal + ) + ) + // .premultiply(slightLeftRotation); + // .multiply(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), -Math.PI*0.5)) + // .multiply(new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), Math.PI)) + } + + // console.log('normal', leftWristNormal.toArray().join(',')); + + const modelBoneWhiteliest = [ + tempAvatar.Hips, + // tempAvatar.Left_shoulder, + tempAvatar.Left_arm, + tempAvatar.Right_arm, + tempAvatar.Left_elbow, + tempAvatar.Right_elbow, + tempAvatar.Left_wrist, + tempAvatar.Right_wrist, + ]; + _setSkeletonWorld(avatar, tempAvatar, modelBoneWhiteliest); + }; +})(); +const _copyAvatar = (srcAvatar, dstModelBones) => { + for (const k in srcAvatar.modelBones) { + const srcBone = srcAvatar.modelBones[k]; + const dstBone = dstModelBones[k]; + dstBone.position.copy(srcBone.position); + dstBone.quaternion.copy(srcBone.quaternion); + // dstBone.initialQuaternion = srcBone.initialQuaternion.clone(); + // console.log('copy initial quaternion', dstBone.initialQuaternion.toArray().join(',')); + } +}; + +const fakeAvatar = _makeFakeAvatar(); const loadPromise = Promise.all([ ((async () => { { @@ -93,13 +608,16 @@ const loadPromise = Promise.all([ avatar.inputs.hmd.position.y = avatar.height; avatar.inputs.hmd.updateMatrixWorld(); // avatar.update(1000); + + _copyAvatar(avatar, fakeAvatar); + fakeAvatar.Root.updateMatrixWorld(); } { previewScene = new THREE.Scene(); - const ambientLight = new THREE.AmbientLight(0xFFFFFF, 2); + const ambientLight = new THREE.AmbientLight(0xFFFFFF, 1); previewScene.add(ambientLight); - const directionalLight = new THREE.DirectionalLight(0xFFFFFF, 2); + const directionalLight = new THREE.DirectionalLight(0xFFFFFF, 1); directionalLight.position.set(1, 2, 3); previewScene.add(directionalLight); @@ -131,6 +649,8 @@ const loadPromise = Promise.all([ let poselm3D = results.ea; let rightHandlm = results.rightHandLandmarks; let leftHandlm = results.leftHandLandmarks; + + // window.results = results; /* for (const lms of [ poselm3D, @@ -150,7 +670,8 @@ const loadPromise = Promise.all([ if (facelm) { let faceRig = Kalidokit.Face.solve(facelm,{runtime:'mediapipe',video:videoEl}) - let poseRig = Kalidokit.Pose.solve(poselm3D,poselm,{runtime:'mediapipe',video:videoEl}) + // let poseRig = Kalidokit.Pose.solve(poselm3D,poselm,{runtime:'mediapipe',video:videoEl}) + _solvePoseToAvatar(poselm3D, leftHandlm, rightHandlm, fakeAvatar); let rightHandRig = rightHandlm ? Kalidokit.Hand.solve(rightHandlm,"Right") : null; let leftHandRig = leftHandlm ? Kalidokit.Hand.solve(leftHandlm,"Left") : null; @@ -224,10 +745,10 @@ const loadPromise = Promise.all([ rightHandRig ? rightHandRig : null, leftHandRig ? leftHandRig : null, ]; */ - if (poseRig) { - avatar.inputs.hmd.quaternion.copy(y180Quaternion); - } - avatar.poseTracking = poseRig; + // if (poseRig) { + // avatar.inputs.hmd.quaternion.copy(y180Quaternion); + // } + avatar.poseTracking = fakeAvatar; avatar.handTracking = [ leftHandRig, rightHandRig, @@ -239,7 +760,7 @@ const loadPromise = Promise.all([ avatar.setHandEnabled(0, true); } - window.poseRig = poseRig; + // window.poseRig = poseRig; if (rightHandRig) { window.rightHandRig = rightHandRig; }