From b05bbdd041ba14d6fab03b76243219fd31ebfa9c Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Fri, 29 Apr 2016 13:54:02 -0700 Subject: [PATCH] don't oscillate hands when both triggers are pulled. --- examples/controllers/handControllerPointer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/controllers/handControllerPointer.js b/examples/controllers/handControllerPointer.js index 223a34658f..e7eba78a45 100644 --- a/examples/controllers/handControllerPointer.js +++ b/examples/controllers/handControllerPointer.js @@ -13,8 +13,6 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -print('handControllerPointer version', 10); - // Control the "mouse" using hand controller. (HMD and desktop.) // For now: // Thumb utton 3 is left-mouse, button 4 is right-mouse. What to do on Vive? (Currently primary thumb is left click.) @@ -314,13 +312,16 @@ checkHardware(); var activeHand = Controller.Standard.RightHand; var activeTrigger = rightTrigger; +var inactiveTrigger = leftTrigger; function toggleHand() { if (activeHand === Controller.Standard.RightHand) { activeHand = Controller.Standard.LeftHand; activeTrigger = leftTrigger; + inactiveTrigger = rightTrigger; } else { activeHand = Controller.Standard.RightHand; activeTrigger = rightTrigger; + inactiveTrigger = leftTrigger; } } @@ -389,7 +390,7 @@ function update() { rightTrigger.updateSmoothedTrigger(); if (!handControllerLockOut.expired(now)) { return turnOffVisualization(); } // Let them use mouse it in peace. - if (activeTrigger.triggerSmoothedSqueezed()) { toggleHand(); } + if (activeTrigger.triggerSmoothedSqueezed() && !inactiveTrigger.triggerSmoothedSqueezed()) { toggleHand(); } if (!Menu.isOptionChecked("First Person")) { return turnOffVisualization(); } // What to do? menus can be behind hand! var controllerPose = getControllerPose(activeHand);