From be770c81777dea43f48f149ad2c9636bb8053f87 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 7 Jul 2016 12:39:11 -0700 Subject: [PATCH] make thumb and trigger mode an option --- scripts/system/controllers/teleport.js | 33 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/scripts/system/controllers/teleport.js b/scripts/system/controllers/teleport.js index 147a8634e2..a59711b025 100644 --- a/scripts/system/controllers/teleport.js +++ b/scripts/system/controllers/teleport.js @@ -36,6 +36,8 @@ var SMOOTH_ARRIVAL_SPACING = 0; // var SMOOTH_ARRIVAL_SPACING = 10; // var NUMBER_OF_STEPS = 20; +var USE_THUMB_AND_TRIGGER_MODE = true; + var TARGET_MODEL_URL = 'http://hifi-content.s3.amazonaws.com/james/teleporter/Tele-destiny.fbx'; var TARGET_MODEL_DIMENSIONS = { x: 1.15, @@ -121,8 +123,12 @@ function Teleporter() { this.teleportHand = hand; this.initialize(); this.updateConnected = true; - Script.update.connect(this.updateForThumbAndTrigger); + if (USE_THUMB_AND_TRIGGER_MODE === true) { + Script.update.connect(this.updateForThumbAndTrigger); + } else { + Script.update.connect(this.update); + } }; this.findMidpoint = function(start, end) { @@ -216,7 +222,14 @@ function Teleporter() { } this.exitTeleportMode = function(value) { - Script.update.disconnect(this.updateForThumbAndTrigger); + if (USE_THUMB_AND_TRIGGER_MODE === true) { + Script.update.disconnect(this.updateForThumbAndTrigger); + + } else { + Script.update.disconnect(this.update); + + } + this.updateConnected = null; this.disableMappings(); this.turnOffOverlayBeams(); @@ -644,8 +657,12 @@ function registerMappingsWithThumbAndTrigger() { }); } -//registerMappings(); -registerMappingsWithThumbAndTrigger() +if (USE_THUMB_AND_TRIGGER_MODE === true) { + registerMappingsWithThumbAndTrigger(); +} else { + registerMappings(); +} + var teleporter = new Teleporter(); Controller.enableMapping(mappingName); @@ -658,6 +675,12 @@ function cleanup() { teleporter.deleteTargetOverlay(); teleporter.turnOffOverlayBeams(); if (teleporter.updateConnected !== null) { - Script.update.disconnect(teleporter.updateForThumbAndTrigger); + + if (USE_THUMB_AND_TRIGGER_MODE === true) { + Script.update.disconnect(teleporter.updateForThumbAndTrigger); + + } else { + Script.update.disconnect(teleporter.update); + } } } \ No newline at end of file