From d650c50a5bc5754cfbdc7f0a7d3cd1df62e90428 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Tue, 28 Jun 2016 17:44:30 -0700 Subject: [PATCH] Use normal Script.update (60hz) instead of a timer (@20hz). --- scripts/system/controllers/handControllerPointer.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/system/controllers/handControllerPointer.js b/scripts/system/controllers/handControllerPointer.js index a0f1f47b3c..f7a85b2a43 100644 --- a/scripts/system/controllers/handControllerPointer.js +++ b/scripts/system/controllers/handControllerPointer.js @@ -398,7 +398,7 @@ function update() { } updateSeeking(true); if (!handControllerLockOut.expired(now)) { - return off(); // Let them use mouse it in peace. + return off(); // Let them use mouse in peace. } if (!Menu.isOptionChecked("First Person")) { return off(); // What to do? menus can be behind hand! @@ -406,13 +406,13 @@ function update() { if (!Window.hasFocus() || !Reticle.allowMouseCapture) { return off(); // Don't mess with other apps or paused mouse activity } - leftTrigger.update(); - rightTrigger.update(); var controllerPose = Controller.getPoseValue(activeHand); // Valid if any plugged-in hand controller is "on". (uncradled Hydra, green-lighted Vive...) if (!controllerPose.valid) { return off(); // Controller is cradled. } + leftTrigger.update(); + rightTrigger.update(); var controllerPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, controllerPose.translation), MyAvatar.position); // This gets point direction right, but if you want general quaternion it would be more complicated: @@ -452,12 +452,7 @@ function update() { clearSystemLaser(); Reticle.visible = false; } - -var UPDATE_INTERVAL = 50; // milliseconds. Script.update is too frequent. -var updater = Script.setInterval(update, UPDATE_INTERVAL); -Script.scriptEnding.connect(function () { - Script.clearInterval(updater); -}); +setupHandler(Script.update, update); // Check periodically for changes to setup. var SETTINGS_CHANGE_RECHECK_INTERVAL = 10 * 1000; // milliseconds