From 60f1934e3391bcd1c178aede15c53a52251e373c Mon Sep 17 00:00:00 2001 From: Robert Long <robert@robertlong.me> Date: Thu, 22 Feb 2018 16:44:28 -0800 Subject: [PATCH] Fix hand IK and watch positioning. --- src/components/ik-controller.js | 13 +++++++++++-- templates/room.hbs | 7 ++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/ik-controller.js b/src/components/ik-controller.js index 798314e64..0cbbcb9df 100644 --- a/src/components/ik-controller.js +++ b/src/components/ik-controller.js @@ -102,6 +102,9 @@ AFRAME.registerComponent("ik-controller", { this.rightHandLastVisible = true; this.visibleScale = new Vector3(1, 1, 1); this.invisibleScale = new Vector3(0.0000001, 0.0000001, 0.0000001); + + this.leftHandRotation = new Matrix4().makeRotationFromEuler(new Euler(-Math.PI / 2, Math.PI / 2, 0)); + this.rightHandRotation = new Matrix4().makeRotationFromEuler(new Euler(Math.PI / 2, Math.PI / 2, 0)); }, update(oldData) { @@ -217,7 +220,10 @@ AFRAME.registerComponent("ik-controller", { this.leftHandLastVisible = true; } - leftHand.object3D.matrix.multiplyMatrices(leftController.object3D.matrix, iRootToChest); + leftHand.object3D.matrix + .multiplyMatrices(iRootToChest, leftController.object3D.matrix) + .multiply(this.leftHandRotation); + updateEntityFromMatrix(leftHand); } else { if (this.leftHandLastVisible) { @@ -231,7 +237,10 @@ AFRAME.registerComponent("ik-controller", { rightHand.setAttribute("scale", visibleScale); this.rightHandLastVisible = true; } - rightHand.object3D.matrix.multiplyMatrices(rightController.object3D.matrix, iRootToChest); + rightHand.object3D.matrix + .multiplyMatrices(iRootToChest, rightController.object3D.matrix) + .multiply(this.rightHandRotation); + updateEntityFromMatrix(rightHand); } else { if (this.rightHandLastVisible) { diff --git a/templates/room.hbs b/templates/room.hbs index 874b72bd4..699c93fbc 100644 --- a/templates/room.hbs +++ b/templates/room.hbs @@ -120,7 +120,8 @@ <a-entity id="player-camera" class="camera" - camera="userHeight: 1.6" + camera + position="0 1.6 0" personal-space-bubble look-controls ></a-entity> @@ -162,9 +163,9 @@ id="watch" cached-gltf-model="#watch-model" bone-mute-state-indicator - position="-0.003 0.009 0.085" - rotation="-79.12547150756669 -160.1417037390651 -100.1530225888679" scale="1.5 1.5 1.5" + rotation="0 -90 90" + position="0 -0.04 0" ></a-entity> </a-entity> </template> -- GitLab