From ae65790bf3f0341319e25217cd61d4d802ebc579 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Tue, 14 Jun 2016 18:07:08 -0700 Subject: [PATCH 1/2] no laser (or mouse cursor) from hand controllers unless trigger squeezed --- scripts/system/controllers/handControllerPointer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index 7046ed16a5..7371680c32 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -377,7 +377,7 @@ function turnOffVisualization(optionalEnableClicks) { // because we're showing c if (!optionalEnableClicks) { expireMouseCursor(); clearSystemLaser(); - } else if (!systemLaserOn) { + } else if (!systemLaserOn && activeTrigger.state) { // If the active plugin doesn't implement hand lasers, show the mouse reticle instead. systemLaserOn = HMD.setHandLasers(activeHudLaser, true, LASER_COLOR_XYZW, SYSTEM_LASER_DIRECTION); Reticle.visible = !systemLaserOn; From 6366ca7508ce77de4230900141298669f3c49fcf Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 15 Jun 2016 11:08:59 -0700 Subject: [PATCH 2/2] Go red for full trigger. --- .../system/controllers/handControllerPointer.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index 7371680c32..5873040dd9 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -349,7 +349,8 @@ clickMapping.enable(); // Same properties as handControllerGrab search sphere var BALL_SIZE = 0.011; var BALL_ALPHA = 0.5; -var LASER_COLOR_XYZW = {x: 10 / 255, y: 10 / 255, z: 255 / 255, w: BALL_ALPHA}; +var LASER_SEARCH_COLOR_XYZW = {x: 10 / 255, y: 10 / 255, z: 255 / 255, w: BALL_ALPHA}; +var LASER_TRIGGER_COLOR_XYZW = {x: 250 / 255, y: 10 / 255, z: 10 / 255, w: BALL_ALPHA}; var fakeProjectionBall = Overlays.addOverlay("sphere", { size: 5 * BALL_SIZE, color: {red: 255, green: 10, blue: 10}, @@ -373,15 +374,24 @@ function clearSystemLaser() { HMD.disableHandLasers(BOTH_HUD_LASERS); systemLaserOn = false; } +function setColoredLaser() { // answer trigger state if lasers supported, else falsey. + var color = (activeTrigger.state === 'full') ? LASER_TRIGGER_COLOR_XYZW : LASER_SEARCH_COLOR_XYZW; + return HMD.setHandLasers(activeHudLaser, true, color, SYSTEM_LASER_DIRECTION) && activeTrigger.state; + +} function turnOffVisualization(optionalEnableClicks) { // because we're showing cursor on HUD if (!optionalEnableClicks) { expireMouseCursor(); clearSystemLaser(); - } else if (!systemLaserOn && activeTrigger.state) { + } else if (activeTrigger.state && (!systemLaserOn || (systemLaserOn !== activeTrigger.state))) { // last=>wrong color // If the active plugin doesn't implement hand lasers, show the mouse reticle instead. - systemLaserOn = HMD.setHandLasers(activeHudLaser, true, LASER_COLOR_XYZW, SYSTEM_LASER_DIRECTION); + systemLaserOn = setColoredLaser(); Reticle.visible = !systemLaserOn; + } else if ((systemLaserOn || Reticle.visible) && !activeTrigger.state) { + clearSystemLaser(); + Reticle.visible = false; } + if (!visualizationIsShowing) { return; }