Reset input and navigation state across runtime host and third-person controller upon pointer lock loss
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user