Updated the script to enable usage of mouselook with other camera modes.

This commit is contained in:
rampa3 2023-06-12 21:18:36 +02:00 committed by ksuprynowicz
parent 5d7c9c1cbb
commit e6f2ba65fd

View file

@ -10,14 +10,12 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
var mouseLookEnabled = false; var mouseLookEnabled = false;
var oldMode;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tabletUp; var tabletUp;
var tempOff = false; var tempOff = false;
hmd = AvatarInputs.isHMD; hmd = AvatarInputs.isHMD;
if (!hmd){ if (!hmd){
@ -139,20 +137,11 @@ by rampa3 (https://github.com/rampa3) and vegaslon (https://github.com/vegaslon)
} }
function mouseLookOn() { function mouseLookOn() {
oldMode = Camera.mode;
Camera.mode = "first person";
Camera.captureMouse = true; Camera.captureMouse = true;
} }
function mouseLookOff() { function mouseLookOff() {
Camera.captureMouse = false; Camera.captureMouse = false;
Camera.mode = oldMode;
}
function onCameraModeUpdated(newMode) {
if (Camera.getCaptureMouse()){
Camera.captureMouse = false;
}
} }
Camera.modeUpdated.connect(onCameraModeUpdated); Camera.modeUpdated.connect(onCameraModeUpdated);