Merge pull request #8156 from howard-stearns/use-normal-script-update-frequency-for-handControllerPointer

use normal script update frequency for handControllerPointer
This commit is contained in:
Anthony Thibault 2016-06-30 10:59:56 -07:00 committed by GitHub
commit 61193ebd6d

View file

@ -398,7 +398,7 @@ function update() {
} }
updateSeeking(true); updateSeeking(true);
if (!handControllerLockOut.expired(now)) { 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")) { if (!Menu.isOptionChecked("First Person")) {
return off(); // What to do? menus can be behind hand! return off(); // What to do? menus can be behind hand!
@ -406,13 +406,13 @@ function update() {
if (!Window.hasFocus() || !Reticle.allowMouseCapture) { if (!Window.hasFocus() || !Reticle.allowMouseCapture) {
return off(); // Don't mess with other apps or paused mouse activity return off(); // Don't mess with other apps or paused mouse activity
} }
leftTrigger.update();
rightTrigger.update();
var controllerPose = Controller.getPoseValue(activeHand); var controllerPose = Controller.getPoseValue(activeHand);
// Valid if any plugged-in hand controller is "on". (uncradled Hydra, green-lighted Vive...) // Valid if any plugged-in hand controller is "on". (uncradled Hydra, green-lighted Vive...)
if (!controllerPose.valid) { if (!controllerPose.valid) {
return off(); // Controller is cradled. return off(); // Controller is cradled.
} }
leftTrigger.update();
rightTrigger.update();
var controllerPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, controllerPose.translation), var controllerPosition = Vec3.sum(Vec3.multiplyQbyV(MyAvatar.orientation, controllerPose.translation),
MyAvatar.position); MyAvatar.position);
// This gets point direction right, but if you want general quaternion it would be more complicated: // This gets point direction right, but if you want general quaternion it would be more complicated:
@ -452,12 +452,7 @@ function update() {
clearSystemLaser(); clearSystemLaser();
Reticle.visible = false; Reticle.visible = false;
} }
setupHandler(Script.update, update);
var UPDATE_INTERVAL = 50; // milliseconds. Script.update is too frequent.
var updater = Script.setInterval(update, UPDATE_INTERVAL);
Script.scriptEnding.connect(function () {
Script.clearInterval(updater);
});
// Check periodically for changes to setup. // Check periodically for changes to setup.
var SETTINGS_CHANGE_RECHECK_INTERVAL = 10 * 1000; // milliseconds var SETTINGS_CHANGE_RECHECK_INTERVAL = 10 * 1000; // milliseconds