Fix HUD content displaying only every second HUD recentering

This commit is contained in:
David Rowe 2020-10-24 21:28:49 +13:00
parent 9f95b101fe
commit cbef9d2926

View file

@ -85,7 +85,6 @@ void OverlayConductor::update(float dt) {
if (!desktop) {
return;
}
bool currentVisible = !desktop->property("pinned").toBool();
auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
// centerUI when hmd mode is first enabled and mounted
@ -98,24 +97,24 @@ void OverlayConductor::update(float dt) {
_hmdMode = false;
}
bool shouldRecenter = false;
if (_suppressedByHead) {
if (updateAvatarIsAtRest()) {
_suppressedByHead = false;
shouldRecenter = true;
}
} else {
if (_hmdMode && headNotCenteredInOverlay()) {
_suppressedByHead = true;
}
bool initiateRecenter = false;
if (_hmdMode && headNotCenteredInOverlay()) {
initiateRecenter = true;
}
bool shouldRecenter = false;
if (initiateRecenter || _suppressedByHead) {
_suppressedByHead = !updateAvatarIsAtRest();
shouldRecenter = !_suppressedByHead;
}
bool currentVisible = !desktop->property("pinned").toBool();
bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && !_suppressedByHead;
if (targetVisible != currentVisible) {
offscreenUi->setPinned(!targetVisible);
}
if (shouldRecenter && !_suppressedByHead) {
if (shouldRecenter) {
centerUI();
}
#endif