From 140caf84d8140ab8369175c45e74107e5bde3422 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Fri, 14 Oct 2016 18:30:52 -0700 Subject: [PATCH] never interact with hud elements while holding something --- scripts/system/controllers/handControllerGrab.js | 8 ++++---- scripts/system/controllers/handControllerPointer.js | 5 ++++- scripts/system/libraries/controllers.js | 8 ++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index c3260e8724..84e94e85b6 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -15,9 +15,9 @@ (function() { // BEGIN LOCAL_SCOPE -Script.include("/~/system/libraries/utils.js"); -Script.include("/~/system/libraries/Xform.js"); -Script.include("/~/system/libraries/controllers.js"); +Script.include("../libraries/utils.js"); +Script.include("../libraries/Xform.js"); +Script.include("../libraries/controllers.js"); // // add lines where the hand ray picking is happening @@ -792,7 +792,7 @@ function MyController(hand) { }; this.setState = function(newState, reason) { - + setGrabCommunications((newState === STATE_DISTANCE_HOLDING) || (newState === STATE_NEAR_GRABBING)); if (WANT_DEBUG || WANT_DEBUG_STATE) { var oldStateName = stateToName(this.state); var newStateName = stateToName(newState); diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index b5e38fc38c..1fc0a7a82c 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -20,7 +20,7 @@ // When partially squeezing over a HUD element, a laser or the reticle is shown where the active hand // controller beam intersects the HUD. -Script.include("/~/system/libraries/controllers.js"); +Script.include("../libraries/controllers.js"); // UTILITIES ------------- // @@ -484,6 +484,9 @@ function update() { if (!activeTrigger.state) { return off(); // No trigger } + if (getGrabCommunications()) { + return off(); + } var hudPoint2d = activeHudPoint2d(activeHand); if (!hudPoint2d) { return off(); diff --git a/scripts/system/libraries/controllers.js b/scripts/system/libraries/controllers.js index c77ce4578c..8b5c1bc2fb 100644 --- a/scripts/system/libraries/controllers.js +++ b/scripts/system/libraries/controllers.js @@ -7,6 +7,14 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html /* global MyAvatar, Vec3, Controller, Quat */ +var GRAB_COMMUNICATIONS_SETTING = "io.highfidelity.isFarGrabbing"; +setGrabCommunications = function setFarGrabCommunications(on) { + Settings.setValue(GRAB_COMMUNICATIONS_SETTING, on ? "on" : ""); +} +getGrabCommunications = function getFarGrabCommunications() { + return !!Settings.getValue(GRAB_COMMUNICATIONS_SETTING, ""); +} + // var GRAB_POINT_SPHERE_OFFSET = { x: 0, y: 0.2, z: 0 }; // var GRAB_POINT_SPHERE_OFFSET = { x: 0.1, y: 0.175, z: 0.04 };