show the hand controllers when in third-person+hmd, but currently, they're

at avatar hands instead of physical hand, which is not what we want!
This commit is contained in:
howard-stearns 2016-11-14 13:05:35 -08:00
parent 06a6da3931
commit 47bef18bd4

View file

@ -22,6 +22,19 @@ var desktopMenuItemName = "Desktop";
}
});
var controllerDisplay = false;
function updateControllerDisplay() {
if (HMD.active && Menu.isOptionChecked("Third Person")) {
if (!controllerDisplay) {
HMD.requestShowHandControllers();
controllerDisplay = true;
}
} else if (controllerDisplay) {
HMD.requestHideHandControllers();
controllerDisplay = false;
}
}
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
var button;
// Independent and Entity mode make people sick. Third Person and Mirror have traps that we need to work through.
@ -34,6 +47,7 @@ function onHmdChanged(isHmd) {
desktopOnlyViews.forEach(function (view) {
Menu.setMenuEnabled("View>" + view, !isHmd);
});
updateControllerDisplay();
}
function onClicked(){
var isDesktop = Menu.isOptionChecked(desktopMenuItemName);
@ -52,11 +66,13 @@ if (headset) {
button.clicked.connect(onClicked);
HMD.displayModeChanged.connect(onHmdChanged);
Camera.modeUpdated.connect(updateControllerDisplay);
Script.scriptEnding.connect(function () {
toolBar.removeButton("hmdToggle");
button.clicked.disconnect(onClicked);
HMD.displayModeChanged.disconnect(onHmdChanged);
Camera.modeUpdated.disconnect(updateControllerDisplay);
});
}