From a4ffa7b23f710703425b5ab480e02b76455180b0 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 2 Sep 2016 12:43:56 -0700 Subject: [PATCH] Add disabling of right click menu with vive --- .../controllers/handControllerPointer.js | 2 +- tutorial/tutorial.js | 34 ++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index ce98ed6d8e..f96e117d26 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -363,7 +363,7 @@ function makeToggleAction(hand) { // return a function(0|1) that makes the speci }; } -var clickMapping = Controller.newMapping(Script.resolvePath('') + '-click'); +var clickMapping = Controller.newMapping('handControllerPointer-click'); Script.scriptEnding.connect(clickMapping.disable); // Gather the trigger data for smoothing. diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 53b9b7c3f7..52f57a83f6 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -837,18 +837,34 @@ function stopTutorial() { startTutorial(); -var DISABLE_SPIN_MAPPING = "com.highfidelity.spin.disable"; -var mapping = Controller.newMapping(DISABLE_SPIN_MAPPING); -function noop(value) { } -mapping.from([Controller.Standard.RY]).to(noop); +var TUTORIAL_DISABLE_MAPPING = "com.highfidelity.tutorial.disable"; +var mapping = Controller.newMapping(TUTORIAL_DISABLE_MAPPING); + +function noop(value) { + print("NOOP"); +} + +mapping.from([ + Controller.Vive.LSCenter, + Controller.Vive.LeftApplicationMenu, + Controller.Standard.LeftSecondaryThumb, + Controller.Standard.LeftPrimraryThumb + ]).to(noop); +mapping.from([]).to(noop); +mapping.from([]).to(noop); + +Controller.enableMapping(TUTORIAL_DISABLE_MAPPING); + +Script.scriptEnding.connect(function() { + Controller.disableMapping(TUTORIAL_DISABLE_MAPPING); +}); +Controller.disableMapping('handControllerPointer-click'); + +//mapping.from([Controller.Standard.RY]).to(noop); + //{ "from": "Vive.LeftApplicationMenu", "to": "Standard.LeftSecondaryThumb" }, //mapping.from([Controller.Standard.RY]).when("Controller.Application.Grounded").to(noop); //mapping.from([Controller.Standard.RY]).when(Controller.Application.Grounded).to(noop); -Controller.enableMapping(DISABLE_SPIN_MAPPING); - -Script.scriptEnding.connect(function() { - Controller.disableMapping(DISABLE_SPIN_MAPPING); -}); Script.scriptEnding.connect(stopTutorial);