mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:59:03 +02:00
Delay showing mini tablet
This commit is contained in:
parent
8924f0832a
commit
55d0822b1a
1 changed files with 14 additions and 3 deletions
|
@ -563,6 +563,8 @@
|
||||||
MAX_LATERAL_PINKY_CAMERA_ANGLE_RAD = DEGREES_TO_RADIANS * MAX_LATERAL_PINKY_CAMERA_ANGLE,
|
MAX_LATERAL_PINKY_CAMERA_ANGLE_RAD = DEGREES_TO_RADIANS * MAX_LATERAL_PINKY_CAMERA_ANGLE,
|
||||||
MAX_CAMERA_MINI_ANGLE = 30,
|
MAX_CAMERA_MINI_ANGLE = 30,
|
||||||
MAX_CAMERA_MINI_ANGLE_COS = Math.cos(MAX_CAMERA_MINI_ANGLE * DEGREES_TO_RADIANS),
|
MAX_CAMERA_MINI_ANGLE_COS = Math.cos(MAX_CAMERA_MINI_ANGLE * DEGREES_TO_RADIANS),
|
||||||
|
SHOWING_DELAY = 1000, // ms
|
||||||
|
lastInvisible = [0, 0],
|
||||||
HIDING_DELAY = 1000, // ms
|
HIDING_DELAY = 1000, // ms
|
||||||
lastVisible = [0, 0],
|
lastVisible = [0, 0],
|
||||||
|
|
||||||
|
@ -609,7 +611,8 @@
|
||||||
lateralHandVector,
|
lateralHandVector,
|
||||||
medialAngle,
|
medialAngle,
|
||||||
lateralAngle,
|
lateralAngle,
|
||||||
cameraToMini;
|
cameraToMini,
|
||||||
|
now;
|
||||||
|
|
||||||
// Shouldn't show mini tablet if hand isn't being controlled.
|
// Shouldn't show mini tablet if hand isn't being controlled.
|
||||||
pose = Controller.getPoseValue(hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand);
|
pose = Controller.getPoseValue(hand === LEFT_HAND ? Controller.Standard.LeftHand : Controller.Standard.RightHand);
|
||||||
|
@ -673,11 +676,19 @@
|
||||||
cameraToMini = -Vec3.dot(miniToCameraDirection, Quat.getForward(Camera.orientation));
|
cameraToMini = -Vec3.dot(miniToCameraDirection, Quat.getForward(Camera.orientation));
|
||||||
show = show && (cameraToMini > MAX_CAMERA_MINI_ANGLE_COS);
|
show = show && (cameraToMini > MAX_CAMERA_MINI_ANGLE_COS);
|
||||||
|
|
||||||
|
// Delay showing for a while after it would otherwise be shown, unless it was showing on the other hand.
|
||||||
|
now = Date.now();
|
||||||
|
if (show) {
|
||||||
|
show = now - lastInvisible[hand] >= SHOWING_DELAY || now - lastVisible[otherHand(hand)] <= HIDING_DELAY;
|
||||||
|
} else {
|
||||||
|
lastInvisible[hand] = now;
|
||||||
|
}
|
||||||
|
|
||||||
// Persist showing for a while after it would otherwise be hidden.
|
// Persist showing for a while after it would otherwise be hidden.
|
||||||
if (show) {
|
if (show) {
|
||||||
lastVisible[hand] = Date.now();
|
lastVisible[hand] = now;
|
||||||
} else {
|
} else {
|
||||||
show = Date.now() - lastVisible[hand] <= HIDING_DELAY;
|
show = now - lastVisible[hand] <= HIDING_DELAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue