diff --git a/scripts/system/controllers/controllerModules/hudOverlayPointer.js b/scripts/system/controllers/controllerModules/hudOverlayPointer.js index efbca66d72..f7d5b5a2dd 100644 --- a/scripts/system/controllers/controllerModules/hudOverlayPointer.js +++ b/scripts/system/controllers/controllerModules/hudOverlayPointer.js @@ -30,6 +30,20 @@ 100, makeLaserParams((this.hand + HUD_LASER_OFFSET), false)); + this.getFarGrab = function () { + return getEnabledModuleByName(this.hand === RIGHT_HAND ? ("RightFarGrabEntity") : ("LeftFarGrabEntity")); + } + + this.farGrabActive = function () { + var farGrab = this.getFarGrab(); + // farGrab will be null if module isn't loaded. + if (farGrab) { + return farGrab.targetIsNull(); + } else { + return false; + } + }; + this.getOtherHandController = function() { return (this.hand === RIGHT_HAND) ? Controller.Standard.LeftHand : Controller.Standard.RightHand; }; @@ -79,7 +93,7 @@ this.isReady = function (controllerData) { var otherModuleRunning = this.getOtherModule().running; - if (!otherModuleRunning && HMD.active) { + if (!otherModuleRunning && HMD.active && !this.farGrabActive()) { if (this.processLaser(controllerData)) { this.running = true; return ControllerDispatcherUtils.makeRunningValues(true, [], []); diff --git a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js index ec35dfe081..4f21b44533 100644 --- a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js +++ b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js @@ -37,6 +37,20 @@ Script.include("/~/system/libraries/controllers.js"); 100, makeLaserParams(hand, true)); + this.getFarGrab = function () { + return getEnabledModuleByName(this.hand === RIGHT_HAND ? ("RightFarGrabEntity") : ("LeftFarGrabEntity")); + }; + + this.farGrabActive = function () { + var farGrab = this.getFarGrab(); + // farGrab will be null if module isn't loaded. + if (farGrab) { + return farGrab.targetIsNull(); + } else { + return false; + } + }; + this.grabModuleWantsNearbyOverlay = function(controllerData) { if (controllerData.triggerValues[this.hand] > TRIGGER_ON_VALUE || controllerData.secondaryValues[this.hand] > BUMPER_ON_VALUE) { var nearGrabName = this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay"; @@ -184,7 +198,12 @@ Script.include("/~/system/libraries/controllers.js"); this.dominantHandOverride = false; - this.isReady = function(controllerData) { + this.isReady = function (controllerData) { + // Trivial rejection for when FarGrab is active. + if (this.farGrabActive()) { + return makeRunningValues(false, [], []); + } + var isTriggerPressed = controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE && controllerData.triggerValues[this.otherHand] <= TRIGGER_OFF_VALUE; var type = this.getInteractableType(controllerData, isTriggerPressed, false);