Refactor pointer lock handling and controller deactivation logic in RuntimeHost
This commit is contained in:
@@ -1071,8 +1071,8 @@ export class RuntimeHost {
|
|||||||
loadScene(runtimeScene: RuntimeSceneDefinition) {
|
loadScene(runtimeScene: RuntimeSceneDefinition) {
|
||||||
const requestId = ++this.collisionWorldRequestId;
|
const requestId = ++this.collisionWorldRequestId;
|
||||||
const preservePointerLockDuringLoad =
|
const preservePointerLockDuringLoad =
|
||||||
this.activeController === this.firstPersonController &&
|
this.activeController !== null &&
|
||||||
this.desiredNavigationMode === "firstPerson" &&
|
this.activeController.id === this.desiredNavigationMode &&
|
||||||
document.pointerLockElement === this.domElement;
|
document.pointerLockElement === this.domElement;
|
||||||
|
|
||||||
this.sceneReady = false;
|
this.sceneReady = false;
|
||||||
@@ -1526,7 +1526,13 @@ export class RuntimeHost {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activeController?.deactivate(this.controllerContext);
|
const preservePointerLockDuringControllerSwitch =
|
||||||
|
this.activeController !== null &&
|
||||||
|
document.pointerLockElement === this.domElement;
|
||||||
|
|
||||||
|
this.activeController?.deactivate(this.controllerContext, {
|
||||||
|
releasePointerLock: !preservePointerLockDuringControllerSwitch
|
||||||
|
});
|
||||||
this.interactionSystem.reset();
|
this.interactionSystem.reset();
|
||||||
this.setInteractionPrompt(null);
|
this.setInteractionPrompt(null);
|
||||||
if (nextController === this.firstPersonController) {
|
if (nextController === this.firstPersonController) {
|
||||||
|
|||||||
Reference in New Issue
Block a user