diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 8f54e3b62e..c3260e8724 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -2770,7 +2770,13 @@ var handleHandMessages = function(channel, message, sender) { Messages.messageReceived.connect(handleHandMessages); +var BASIC_TIMER_INTERVAL = 20; // 20ms = 50hz good enough +var updateIntervalTimer = Script.setInterval(function(){ + update(); +}, BASIC_TIMER_INTERVAL); + function cleanup() { + Script.clearInterval(updateIntervalTimer); rightController.cleanup(); leftController.cleanup(); Controller.disableMapping(MAPPING_NAME); @@ -2778,6 +2784,5 @@ function cleanup() { } Script.scriptEnding.connect(cleanup); -Script.update.connect(update); }()); // END LOCAL_SCOPE diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index fb256413ae..b5e38fc38c 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -507,10 +507,15 @@ function update() { clearSystemLaser(); Reticle.visible = false; } -setupHandler(Script.update, update); + +var BASIC_TIMER_INTERVAL = 20; // 20ms = 50hz good enough +var updateIntervalTimer = Script.setInterval(function(){ + update(); +}, BASIC_TIMER_INTERVAL); + // Check periodically for changes to setup. -var SETTINGS_CHANGE_RECHECK_INTERVAL = 10 * 1000; // milliseconds +var SETTINGS_CHANGE_RECHECK_INTERVAL = 10 * 1000; // 10 seconds function checkSettings() { updateFieldOfView(); updateRecommendedArea(); @@ -520,6 +525,7 @@ checkSettings(); var settingsChecker = Script.setInterval(checkSettings, SETTINGS_CHANGE_RECHECK_INTERVAL); Script.scriptEnding.connect(function () { Script.clearInterval(settingsChecker); + Script.clearInterval(updateIntervalTimer); OffscreenFlags.navigationFocusDisabled = false; });