diff --git a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js index 21eeb68b96..bd31c5c42e 100644 --- a/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js +++ b/scripts/system/controllers/toggleAdvancedMovementForHandControllers.js @@ -18,6 +18,7 @@ var mappingName, basicMapping, isChecked; var TURN_RATE = 1000; var MENU_ITEM_NAME = "Advanced Movement For Hand Controllers"; var SETTINGS_KEY = 'advancedMovementForHandControllersIsChecked'; +var isDisabled = false; var previousSetting = Settings.getValue(SETTINGS_KEY); if (previousSetting === '' || previousSetting === false || previousSetting === 'false') { previousSetting = false; @@ -146,4 +147,19 @@ HMD.displayModeChanged.connect(function(isHMDMode) { } }); + +var HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL = 'Hifi-Advanced-Movement-Disabler'; +function handleMessage(channel, message, sender) { + if (channel == HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL) { + if (message == 'disable') { + isDisabled = true; + } else if (message == 'enable') { + isDisabled = false; + } + } +} + +Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL); +Messages.messageReceived.connect(handleHandMessages); + }()); // END LOCAL_SCOPE diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index a01d1616e0..4e95bf856a 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -216,6 +216,8 @@ stepDisableControllers.prototype = { start: function(onFinish) { editEntitiesWithTag('door', { visible: true }); Menu.setIsOptionChecked("Overlays", false); + Controller.disableMapping('handControllerPointer-click'); + Messages.sendLocalMessage('Hifi-Advanced-Movement-Disabler', 'disable'); Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both'); Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ nearGrabEnabled: true, @@ -230,6 +232,30 @@ stepDisableControllers.prototype = { } }; +var stepEnableControllers = function(name) { + this.tag = name; + this.shouldLog = false; +} +stepEnableControllers.prototype = { + start: function(onFinish) { + editEntitiesWithTag('door', { visible: false }); + Menu.setIsOptionChecked("Overlays", true); + Controller.enableMapping('handControllerPointer-click'); + Messages.sendLocalMessage('Hifi-Advanced-Movement-Disabler', 'enable'); + Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'none'); + Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ + nearGrabEnabled: true, + holdEnabled: true, + farGrabEnabled: true, + })); + setControllerPartLayer('touchpad', 'blank'); + setControllerPartLayer('tips', 'blank'); + onFinish(); + }, + cleanup: function() { + } +}; + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // @@ -980,6 +1006,7 @@ TutorialManager = function() { new stepTurnAround("turnAround"), new stepTeleport("teleport"), new stepFinish("finish"), + new stepEnableControllers("enableControllers"), ]; for (var i = 0; i < STEPS.length; ++i) { STEPS[i].cleanup(); @@ -1041,7 +1068,6 @@ TutorialManager = function() { Script.scriptEnding.connect(function() { Controller.enableMapping('handControllerPointer-click'); }); -Controller.disableMapping('handControllerPointer-click'); // var entityID = '{be3d10a3-262a-4827-b30c-ec025c4325dc}'; // var token = new OwnershipToken(Math.random() * 100000, entityID, {