Make mini tablet disappear when using grip the same as the trigger

This commit is contained in:
David Rowe 2018-09-21 13:45:10 +12:00
parent eac1666e01
commit 9426f72652

View file

@ -617,11 +617,12 @@
pose = Controller.getPoseValue(hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand); pose = Controller.getPoseValue(hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand);
show = pose.valid; show = pose.valid;
// Shouldn't show mini tablet on hand if that hand's trigger is pressed (i.e., laser is searching or grabbing // Shouldn't show mini tablet on hand if that hand's trigger or grip are pressed (i.e., laser is searching or hand
// something) or the other hand's trigger is pressed unless it is pointing at the mini tablet. Allow the triggers // is grabbing something) or the other hand's trigger is pressed unless it is pointing at the mini tablet. Allow
// to be pressed briefly to allow for the grabbing process. // the triggers to be pressed briefly to allow for the grabbing process.
if (show) { if (show) {
isLeftTriggerOff = Controller.getValue(Controller.Standard.LT) < TRIGGER_OFF_VALUE; isLeftTriggerOff = Controller.getValue(Controller.Standard.LT) < TRIGGER_OFF_VALUE
&& Controller.getValue(Controller.Standard.LeftGrip) < TRIGGER_OFF_VALUE;
if (!isLeftTriggerOff) { if (!isLeftTriggerOff) {
if (leftTriggerOn === 0) { if (leftTriggerOn === 0) {
leftTriggerOn = Date.now(); leftTriggerOn = Date.now();
@ -631,7 +632,8 @@
} else { } else {
leftTriggerOn = 0; leftTriggerOn = 0;
} }
isRightTriggerOff = Controller.getValue(Controller.Standard.RT) < TRIGGER_OFF_VALUE; isRightTriggerOff = Controller.getValue(Controller.Standard.RT) < TRIGGER_OFF_VALUE
&& Controller.getValue(Controller.Standard.RightGrip) < TRIGGER_OFF_VALUE;
if (!isRightTriggerOff) { if (!isRightTriggerOff) {
if (rightTriggerOn === 0) { if (rightTriggerOn === 0) {
rightTriggerOn = Date.now(); rightTriggerOn = Date.now();