mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:37:31 +02:00
Expand tablet after it's been released from grab by other hand
This commit is contained in:
parent
49f5d5f2b7
commit
f5c49026ab
1 changed files with 25 additions and 5 deletions
|
@ -64,10 +64,11 @@
|
||||||
PROXY_HIDING = 2,
|
PROXY_HIDING = 2,
|
||||||
PROXY_SHOWING = 3,
|
PROXY_SHOWING = 3,
|
||||||
PROXY_VISIBLE = 4,
|
PROXY_VISIBLE = 4,
|
||||||
PROXY_EXPANDING = 5,
|
PROXY_GRABBED = 5,
|
||||||
TABLET_OPEN = 6,
|
PROXY_EXPANDING = 6,
|
||||||
STATE_STRINGS = ["PROXY_DISABLED", "PROXY_HIDDEN", "PROXY_HIDING", "PROXY_SHOWING", "PROXY_VISIBLE", "PROXY_EXPANDING",
|
TABLET_OPEN = 7,
|
||||||
"TABLET_OPEN"],
|
STATE_STRINGS = ["PROXY_DISABLED", "PROXY_HIDDEN", "PROXY_HIDING", "PROXY_SHOWING", "PROXY_VISIBLE", "PROXY_GRABBED",
|
||||||
|
"PROXY_EXPANDING", "TABLET_OPEN"],
|
||||||
STATE_MACHINE,
|
STATE_MACHINE,
|
||||||
rezzerState = PROXY_DISABLED,
|
rezzerState = PROXY_DISABLED,
|
||||||
proxyHand,
|
proxyHand,
|
||||||
|
@ -513,6 +514,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateProxyGrabbed() {
|
||||||
|
// Hide proxy if tablet has been displayed by other means.
|
||||||
|
if (HMD.showTablet) {
|
||||||
|
setState(PROXY_HIDDEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function expandProxy() {
|
function expandProxy() {
|
||||||
var scaleFactor = (Date.now() - proxyExpandStart) / PROXY_EXPAND_DURATION;
|
var scaleFactor = (Date.now() - proxyExpandStart) / PROXY_EXPAND_DURATION;
|
||||||
if (scaleFactor < 1) {
|
if (scaleFactor < 1) {
|
||||||
|
@ -598,7 +606,12 @@
|
||||||
update: updateProxyVisible,
|
update: updateProxyVisible,
|
||||||
exit: null
|
exit: null
|
||||||
},
|
},
|
||||||
PROXY_EXPANDING: { // Tablet proxy has been grabbed and is expanding before showing tablet proper.
|
PROXY_GRABBED: { // Tablet proxy is grabbed by other hand.
|
||||||
|
enter: null,
|
||||||
|
update: updateProxyGrabbed,
|
||||||
|
exit: null
|
||||||
|
},
|
||||||
|
PROXY_EXPANDING: { // Tablet proxy is expanding before showing tablet proper.
|
||||||
enter: enterProxyExpanding,
|
enter: enterProxyExpanding,
|
||||||
update: updateProxyExanding,
|
update: updateProxyExanding,
|
||||||
exit: exitProxyExpanding
|
exit: exitProxyExpanding
|
||||||
|
@ -655,6 +668,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.action === "grab" && rezzerState === PROXY_VISIBLE) {
|
if (message.action === "grab" && rezzerState === PROXY_VISIBLE) {
|
||||||
|
hand = message.joint === HAND_NAMES[proxyHand] ? proxyHand : otherHand(proxyHand);
|
||||||
|
if (hand === proxyHand) {
|
||||||
|
setState(PROXY_EXPANDING, hand);
|
||||||
|
} else {
|
||||||
|
setState(PROXY_GRABBED);
|
||||||
|
}
|
||||||
|
} else if (message.action === "release" && rezzerState === PROXY_GRABBED) {
|
||||||
hand = message.joint === HAND_NAMES[proxyHand] ? proxyHand : otherHand(proxyHand);
|
hand = message.joint === HAND_NAMES[proxyHand] ? proxyHand : otherHand(proxyHand);
|
||||||
setState(PROXY_EXPANDING, hand);
|
setState(PROXY_EXPANDING, hand);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue