Implement handling for third-person pointer lock release

This commit is contained in:
2026-04-27 18:12:21 +02:00
parent 6eb059b6fc
commit eb7dd51df3
2 changed files with 23 additions and 0 deletions

View File

@@ -166,6 +166,7 @@ export interface RuntimeControllerContext {
input: RuntimeTargetLookInput
): RuntimeTargetLookInputResult;
handleRuntimeTargetLookBoundaryReached?(): boolean;
handleThirdPersonPointerLockReleased?(): boolean;
isCameraDrivenExternally(): boolean;
getCameraYawRadians(): number;
isInputSuspended(): boolean;

View File

@@ -952,6 +952,28 @@ export class RuntimeHost {
this.clearActiveRuntimeTarget();
return false;
},
handleThirdPersonPointerLockReleased: () => {
if (
this.activeController !== this.thirdPersonController ||
this.activeRuntimeTargetReference === null
) {
return false;
}
const clearTargetKeyboardBinding =
this.resolveRuntimePlayerInputBindings().keyboard.clearTarget;
if (
isPlayerStartMouseBindingCode(clearTargetKeyboardBinding) ||
clearTargetKeyboardBinding !== "Escape"
) {
return false;
}
this.clearActiveRuntimeTarget();
this.previousClearTargetInputActive = true;
return true;
},
isCameraDrivenExternally: () =>
this.resolveActiveRuntimeCameraRig() !== null ||
this.resolveDialogueAttentionNpc() !== null,