Fix disabling mouse look when switching to VR mode

This commit is contained in:
ksuprynowicz 2023-06-25 12:12:51 +02:00
parent 3fe3284258
commit 89f826fa5c

View file

@ -6,7 +6,7 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
var away;
var hmd;
var hmd = HMD.active;
var mouseLookEnabled = Camera.getMouseLook();
@ -16,8 +16,6 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
var tempOff = false;
hmd = AvatarInputs.isHMD;
Camera.mouseLookChanged.connect(onMouseLookChanged);
function onMouseLookChanged(newMouseLook) {
@ -112,11 +110,11 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
}
}
AvatarInputs.isHMDChanged.connect(onIsHMDChanged);
HMD.displayModeChanged.connect(onDisplayModeChanged);
function onIsHMDChanged() {
function onDisplayModeChanged() {
if (mouseLookEnabled) {
if (AvatarInputs.isHMD) {
if (HMD.active) {
hmd = true;
mouseLookOff();
} else {
@ -149,7 +147,7 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
tablet.tabletShownChanged.disconnect(onTabletShownChanged);
MyAvatar.wentAway.disconnect(onWentAway);
MyAvatar.wentActive.disconnect(onWentActive);
AvatarInputs.isHMDChanged.disconnect(onIsHMDChanged);
HMD.displayModeChanged.disconnect(onDisplayModeChanged);
Camera.modeUpdated.disconnect(onCameraModeUpdated);
Script.scriptEnding.disconnect(onScriptEnding);
}