Reset input and navigation state across runtime host and third-person controller upon pointer lock loss

This commit is contained in:
2026-04-27 19:33:58 +02:00
parent 711d53969d
commit efefdacd67
2 changed files with 13 additions and 0 deletions

View File

@@ -977,6 +977,10 @@ export class RuntimeHost {
if (previousPointerLocked && !nextPointerLocked) {
this.lastPointerLockReleaseAt = performance.now();
this.pressedKeys.clear();
this.previousInteractInputActive = false;
this.previousClearTargetInputActive = false;
this.previousPauseInputActive = false;
}
this.currentPlayerControllerTelemetry = telemetry;

View File

@@ -786,8 +786,17 @@ export class ThirdPersonNavigationController implements NavigationController {
return;
}
const wasPointerLocked = this.pointerLocked;
const pointerLocked =
document.pointerLockElement === this.context.domElement;
if (wasPointerLocked && !pointerLocked) {
this.pressedKeys.clear();
this.jumpPressed = false;
this.jumpHoldRemainingMs = 0;
this.pointerLookInputPending = false;
}
this.pointerLocked = pointerLocked;
this.dragging = false;
this.context.setRuntimeMessage(