From 9f7a2b18e6cbe1fd5a4fc7614161685b6371fbc3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 5 Jan 2018 10:04:39 +1300 Subject: [PATCH] Use laser from dominant hand if both hands are pointing at the tablet --- .../controllerModules/webSurfaceLaserInput.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js index 4e9171f924..eb9a426eeb 100644 --- a/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js +++ b/scripts/system/controllers/controllerModules/webSurfaceLaserInput.js @@ -81,10 +81,15 @@ Script.include("/~/system/libraries/controllers.js"); this.parameters.handLaser.allwaysOn = !Settings.getValue(PREFER_STYLUS_OVER_LASER, false); }; + this.dominantHand = function () { + return MyAvatar.getDominantHand() === "right" ? 1 : 0; + }; + this.isReady = function (controllerData) { var otherModuleRunning = this.getOtherModule().running; - if ((this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)) && - !otherModuleRunning) { + otherModuleRunning = otherModuleRunning && this.dominantHand() !== this.hand; + if (!otherModuleRunning + && (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData))) { this.updateAllwaysOn(); if (this.parameters.handLaser.allwaysOn || controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE) { return makeRunningValues(true, [], []); @@ -94,8 +99,10 @@ Script.include("/~/system/libraries/controllers.js"); }; this.run = function (controllerData, deltaTime) { + var otherModuleRunning = this.getOtherModule().running; + otherModuleRunning = otherModuleRunning && this.dominantHand() !== this.hand; var grabModuleNeedsToRun = this.grabModuleWantsNearbyOverlay(controllerData); - if (!grabModuleNeedsToRun && (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE + if (!otherModuleRunning && !grabModuleNeedsToRun && (controllerData.triggerValues[this.hand] > TRIGGER_OFF_VALUE || this.parameters.handLaser.allwaysOn && (this.isPointingAtOverlay(controllerData) || this.isPointingAtWebEntity(controllerData)))) { this.running = true;