mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:09:05 +02:00
Fix mini tablet not reliably being grabbed
This commit is contained in:
parent
54dd868b3c
commit
0437c50c06
1 changed files with 34 additions and 5 deletions
|
@ -543,6 +543,11 @@
|
||||||
isGoto = false,
|
isGoto = false,
|
||||||
TABLET_ADDRESS_DIALOG = "hifi/tablet/TabletAddressDialog.qml",
|
TABLET_ADDRESS_DIALOG = "hifi/tablet/TabletAddressDialog.qml",
|
||||||
|
|
||||||
|
// Trigger values.
|
||||||
|
leftTriggerOn = 0,
|
||||||
|
rightTriggerOn = 0,
|
||||||
|
MAX_TRIGGER_ON_TIME = 100,
|
||||||
|
|
||||||
// Visibility.
|
// Visibility.
|
||||||
MIN_HAND_CAMERA_ANGLE = 30,
|
MIN_HAND_CAMERA_ANGLE = 30,
|
||||||
DEGREES_180 = 180,
|
DEGREES_180 = 180,
|
||||||
|
@ -579,6 +584,10 @@
|
||||||
// Should show mini tablet if it would be oriented toward the camera.
|
// Should show mini tablet if it would be oriented toward the camera.
|
||||||
var show,
|
var show,
|
||||||
pose,
|
pose,
|
||||||
|
isLeftTriggerOff,
|
||||||
|
isRightTriggerOff,
|
||||||
|
wasLeftTriggerOff = true,
|
||||||
|
wasRightTriggerOff = true,
|
||||||
jointIndex,
|
jointIndex,
|
||||||
handPosition,
|
handPosition,
|
||||||
handOrientation,
|
handOrientation,
|
||||||
|
@ -593,12 +602,32 @@
|
||||||
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 is pressed (i.e., laser is searching or grabbing
|
||||||
// something) or the other hand's trigger is pressed unless it is pointing at the mini tablet.
|
// something) or the other hand's trigger is pressed unless it is pointing at the mini tablet. Allow the triggers
|
||||||
|
// to be pressed briefly to allow for the grabbing process.
|
||||||
if (show) {
|
if (show) {
|
||||||
show = Controller.getValue(hand === LEFT_HAND ? Controller.Standard.LT : Controller.Standard.RT) <
|
isLeftTriggerOff = Controller.getValue(Controller.Standard.LT) < TRIGGER_OFF_VALUE;
|
||||||
TRIGGER_OFF_VALUE
|
if (!isLeftTriggerOff) {
|
||||||
&& (Controller.getValue(hand === LEFT_HAND ? Controller.Standard.RT : Controller.Standard.LT) <
|
if (leftTriggerOn === 0) {
|
||||||
TRIGGER_OFF_VALUE || ui.isLaserPointingAt());
|
leftTriggerOn = Date.now();
|
||||||
|
} else {
|
||||||
|
wasLeftTriggerOff = Date.now() - leftTriggerOn < MAX_TRIGGER_ON_TIME;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
leftTriggerOn = 0;
|
||||||
|
}
|
||||||
|
isRightTriggerOff = Controller.getValue(Controller.Standard.RT) < TRIGGER_OFF_VALUE;
|
||||||
|
if (!isRightTriggerOff) {
|
||||||
|
if (rightTriggerOn === 0) {
|
||||||
|
rightTriggerOn = Date.now();
|
||||||
|
} else {
|
||||||
|
wasRightTriggerOff = Date.now() - rightTriggerOn < MAX_TRIGGER_ON_TIME;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rightTriggerOn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
show = (hand === LEFT_HAND ? wasLeftTriggerOff : wasRightTriggerOff)
|
||||||
|
&& ((hand === LEFT_HAND ? wasRightTriggerOff : wasLeftTriggerOff) || ui.isLaserPointingAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should show mini tablet if it would be oriented toward the camera.
|
// Should show mini tablet if it would be oriented toward the camera.
|
||||||
|
|
Loading…
Reference in a new issue