diff --git a/src/assets/avatars/Bot_SkinnedWithAnim.fbx b/src/assets/avatars/Bot_SkinnedWithAnim.fbx deleted file mode 100755 index b1399bef5217ed4a80873a4cdee8031fa04a5d28..0000000000000000000000000000000000000000 Binary files a/src/assets/avatars/Bot_SkinnedWithAnim.fbx and /dev/null differ diff --git a/src/assets/avatars/Bot_SkinnedWithAnimation.glb b/src/assets/avatars/Bot_SkinnedWithAnimation.glb index d50b12ad2d4b601a09edeb598bfcfa35a75d9188..7d2d8468967957470e272a96b4f1e1fbc238a4fe 100755 Binary files a/src/assets/avatars/Bot_SkinnedWithAnimation.glb and b/src/assets/avatars/Bot_SkinnedWithAnimation.glb differ diff --git a/src/components/animated-robot-hands.js b/src/components/animated-robot-hands.js index 603d7f5e94eefbad69798a1f5ccdaf4f05dc8555..fb16444e8787f23938576230095768d59f23a19c 100644 --- a/src/components/animated-robot-hands.js +++ b/src/components/animated-robot-hands.js @@ -1,11 +1,13 @@ // Global THREE, AFRAME const POSES = { - open: "open", + open: "allOpen", + thumbDown: "thumbDown", + indexDown: "indexDown", + mrpDown: "mrpDown", + thumbUp: "thumbsUp", point: "point", - pointThumb: "point", - fist: "grip", - hold: "grip", - thumbUp: "thumbup" + fist: "allGrip", + pinch: "pinch" }; AFRAME.registerComponent("animated-robot-hands", { @@ -23,12 +25,13 @@ AFRAME.registerComponent("animated-robot-hands", { onModelLoaded: function() { // Get the three.js object in the scene graph that has the animation data const root = this.el.object3D.children[0].children[0].children[0]; + window.root = root; this.mixer = new THREE.AnimationMixer(root); // Set hands to open pose because the bind pose is funky due // to the workaround for FBX2glTF animations. - this.openL = this.mixer.clipAction("open_L"); - this.openR = this.mixer.clipAction("open_R"); + this.openL = this.mixer.clipAction(POSES.open + "_L"); + this.openR = this.mixer.clipAction(POSES.open + "_R"); this.openL.play(); this.openR.play(); @@ -55,9 +58,8 @@ AFRAME.registerComponent("animated-robot-hands", { // to the target pose, rather than stopping previous actions altogether. playAnimation: function(evt) { if (!this.loaded) return; - const { current, previous } = evt.detail; - var mixer = this.mixer; const isLeft = evt.target === this.data.leftHand; + // Stop the initial animations we started when the model loaded. if (!this.openLStopped && isLeft) { this.openL.stop(); this.openLStopped = true; @@ -65,6 +67,9 @@ AFRAME.registerComponent("animated-robot-hands", { this.openR.stop(); this.openRStopped = true; } + + const { current, previous } = evt.detail; + const mixer = this.mixer; const suffix = isLeft ? "_L" : "_R"; const prevPose = POSES[previous] + suffix; const currPose = POSES[current] + suffix; @@ -78,6 +83,9 @@ AFRAME.registerComponent("animated-robot-hands", { } const duration = 0.065; + // console.log( + // `Animating ${isLeft ? "left" : "right"} hand from ${prevPose} to ${currPose} over ${duration} seconds.` + // ); var from = mixer.clipAction(prevPose); var to = mixer.clipAction(currPose); from.fadeOut(duration); @@ -90,7 +98,5 @@ AFRAME.registerComponent("animated-robot-hands", { this["pose" + suffix + "_to"] = to; this["pose" + suffix + "_from"] = from; - - // console.log(`Animating ${isLeft ? "left" : "right"} hand from ${prevPose} to ${currPose} over ${duration} seconds.`); } }); diff --git a/src/components/hand-controls2.js b/src/components/hand-controls2.js index 6a7b19c99fa958e7ef8ef52de473187a4d76f4e0..faebc98d8fe58616742376a505362247a27c160d 100644 --- a/src/components/hand-controls2.js +++ b/src/components/hand-controls2.js @@ -1,10 +1,13 @@ const POSES = { open: "open", point: "point", - pointThumb: "pointThumb", fist: "fist", hold: "hold", - thumbUp: "thumbUp" + thumbUp: "thumbUp", + thumbDown: "thumbDown", + indexDown: "indexDown", + pinch: "pinch", + mrpDown: "mrpDown" }; AFRAME.registerComponent("hand-controls2", { @@ -126,13 +129,13 @@ AFRAME.registerComponent("hand-controls2", { } else if (!thumb && index && middle && ring && pinky) { return POSES.thumbUp; } else if (!thumb && !index && middle && ring && pinky) { - return POSES.pointThumb; + return POSES.mrpDown; } else if (!thumb && index && !middle && !ring && !pinky) { - return POSES.hold; + return POSES.indexDown; } else if (thumb && !index && !middle && !ring && !pinky) { - return POSES.hold; + return POSES.thumbDown; } else if (thumb && index && !middle && !ring && !pinky) { - return POSES.hold; + return POSES.pinch; } else if (thumb && !index && middle && ring && pinky) { return POSES.point; }