fixed menu pop up delay

This commit is contained in:
Dante Ruiz 2016-11-07 17:16:24 +00:00
parent 1a83cc2c3e
commit e22c36b4b7
2 changed files with 23 additions and 25 deletions

View file

@ -45,7 +45,7 @@
{ "from": "GamePad.RS", "to": "Standard.RS" }, { "from": "GamePad.RS", "to": "Standard.RS" },
{ "from": "GamePad.Start", "to": "Actions.CycleCamera" }, { "from": "GamePad.Start", "to": "Actions.CycleCamera" },
{ "from": "GamePad.Back", "to": "Actions.ContextMenu" }, { "from": "GamePad.Back", "to": "Standard.Start" },
{ "from": "GamePad.DU", "to": "Standard.DU" }, { "from": "GamePad.DU", "to": "Standard.DU" },
{ "from": "GamePad.DD", "to": "Standard.DD" }, { "from": "GamePad.DD", "to": "Standard.DD" },

View file

@ -203,6 +203,7 @@ function overlayFromWorldPoint(point) {
return { x: horizontalPixels, y: verticalPixels }; return { x: horizontalPixels, y: verticalPixels };
} }
var gamePad = Controller.findDevice("GamePad");
function activeHudPoint2dGamePad() { function activeHudPoint2dGamePad() {
if (!HMD.active) { if (!HMD.active) {
return; return;
@ -227,13 +228,10 @@ function activeHudPoint2dGamePad() {
return hudPoint2d; return hudPoint2d;
} }
var gamePad = Controller.findDevice("GamePad");
function activeHudPoint2d(activeHand) { // if controller is valid, update reticle position and answer 2d point. Otherwise falsey. function activeHudPoint2d(activeHand) { // if controller is valid, update reticle position and answer 2d point. Otherwise falsey.
var controllerPose = getControllerWorldLocation(activeHand, true); // note: this will return head pose if hand pose is invalid (third eye) var controllerPose = getControllerWorldLocation(activeHand, true); // note: this will return head pose if hand pose is invalid (third eye)
if (!controllerPose.valid) { if (!controllerPose.valid) {
if (gamePad) {
return activeHudPoint2dGamePad();
}
return; // Controller is cradled. return; // Controller is cradled.
} }
var controllerPosition = controllerPose.position; var controllerPosition = controllerPose.position;
@ -448,12 +446,12 @@ clickMapping.from(Controller.Standard.LeftSecondaryThumb).peek().to(function (cl
} }
wantsMenu = clicked; wantsMenu = clicked;
}); });
clickMapping.from(Controller.Hardware.GamePad.Back).peek().to(function () { clickMapping.from(Controller.Standard.Start).peek().to(function (clicked) {
// Wait a tick an allow the reticle to be correctly set to the players look at position before invoking if (clicked) {
// ContextMenu action
Script.setTimeout(function () {
activeHudPoint2dGamePad(); activeHudPoint2dGamePad();
}, 0); }
wantsMenu = clicked;
}); });
clickMapping.from(Controller.Hardware.Keyboard.RightMouseClicked).peek().to(function () { clickMapping.from(Controller.Hardware.Keyboard.RightMouseClicked).peek().to(function () {
// Allow the reticle depth to be set correctly: // Allow the reticle depth to be set correctly: