From 543e9e3eb5c1a74c3854e7f30af14cb7dbd089ab Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 15 Sep 2014 20:22:53 -0700 Subject: [PATCH] Access wrist controller rotation only once per frame --- examples/leapHands.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/leapHands.js b/examples/leapHands.js index 08d4a918bf..e7080f0cbb 100644 --- a/examples/leapHands.js +++ b/examples/leapHands.js @@ -212,6 +212,7 @@ var leapHands = (function () { handPitch, handYaw, handRotation, + wristAbsRotation, locRotation; for (h = 0; h < NUM_HANDS; h += 1) { @@ -229,8 +230,9 @@ var leapHands = (function () { // TODO: 2.0* scale factor should not be necessary; Leap Motion controller code needs investigating. handRoll = 2.0 * -hands[h].controller.getAbsRotation().z; - handPitch = 2.0 * -wrists[h].controller.getAbsRotation().x; - handYaw = 2.0 * wrists[h].controller.getAbsRotation().y; + wristAbsRotation = wrists[h].controller.getAbsRotation(); + handPitch = 2.0 * -wristAbsRotation.x; + handYaw = 2.0 * wristAbsRotation.y; // TODO: Leap Motion controller's right-hand roll calculation only works if physical hand is upside down. // Approximate fix is to add a fudge factor.