From 41aa485f11f3511a7fc25398996ed53cf9703ce3 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Tue, 2 Aug 2016 12:52:35 -0700 Subject: [PATCH] one hand teleprt --- .../system/controllers/handControllerGrab.js | 12 +++++++--- scripts/system/controllers/teleport.js | 24 ++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index ab386aa735..4458679742 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1378,7 +1378,7 @@ function MyController(hand) { }; this.distanceHoldingEnter = function() { - Messages.sendLocalMessage('Hifi-Teleport-Disabler','disable'); + Messages.sendLocalMessage('Hifi-Teleport-Disabler','both'); this.clearEquipHaptics(); // controller pose is in avatar frame @@ -1636,8 +1636,14 @@ function MyController(hand) { }; this.nearGrabbingEnter = function() { - Messages.sendLocalMessage('Hifi-Teleport-Disabler','disable'); + if (this.hand === 0) { + Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'left'); + } + if (this.hand === 1) { + Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'right'); + + } this.lineOff(); this.overlayLineOff(); @@ -1964,7 +1970,7 @@ function MyController(hand) { }; this.release = function() { - Messages.sendLocalMessage('Hifi-Teleport-Disabler','enable'); + Messages.sendLocalMessage('Hifi-Teleport-Disabler','none'); this.turnOffVisualizations(); var noVelocity = false; diff --git a/scripts/system/controllers/teleport.js b/scripts/system/controllers/teleport.js index 433bca9379..d32eb77d34 100644 --- a/scripts/system/controllers/teleport.js +++ b/scripts/system/controllers/teleport.js @@ -239,11 +239,14 @@ function Teleporter() { this.update = function() { - if (isDisabled) { + if (isDisabled === 'both') { return; } if (teleporter.teleportHand === 'left') { + if (isDisabled === 'left') { + return; + } teleporter.leftRay(); //|| leftTrigger.buttonValue === 0 if ((leftPad.buttonValue === 0) && inTeleportMode === true) { @@ -252,6 +255,9 @@ function Teleporter() { } } else { + if (isDisabled === 'right') { + return; + } teleporter.rightRay(); //|| rightTrigger.buttonValue === 0 if ((rightPad.buttonValue === 0) && inTeleportMode === true) { @@ -588,7 +594,7 @@ function registerMappings() { teleportMapping.from(Controller.Standard.LeftPrimaryThumb) // .when(leftTrigger.down) .to(function(value) { - if (isDisabled === true) { + if (isDisabled === 'left' || isDisabled === 'both') { return; } if (activationTimeout !== null) { @@ -604,7 +610,7 @@ function registerMappings() { teleportMapping.from(Controller.Standard.RightPrimaryThumb) // .when(rightTrigger.down) .to(function(value) { - if (isDisabled === true) { + if (isDisabled === 'right' || isDisabled === 'both') { return; } if (activationTimeout !== null) { @@ -669,10 +675,16 @@ var handleHandMessages = function(channel, message, sender) { var data; if (sender === MyAvatar.sessionUUID) { if (channel === 'Hifi-Teleport-Disabler') { - if (message === 'disable') { - isDisabled = true; + if (message === 'both') { + isDisabled = 'both'; } - if (message === 'enable') { + if (message === 'left') { + isDisabled = 'left'; + } + if (message === 'right') { + isDisabled = 'right' + } + if (message === 'none') { isDisabled = false; }