Refactor first-person navigation logic and remove explicit pointer lock handling

This commit is contained in:
2026-04-27 18:43:49 +02:00
parent 2d194832aa
commit 1f198aee02
6 changed files with 15 additions and 116 deletions

View File

@@ -510,25 +510,23 @@ export class FirstPersonNavigationController implements NavigationController {
};
private handleMouseMove = (event: MouseEvent) => {
const context = this.context;
if (
!this.pointerLocked ||
context === null ||
context.isInputSuspended() === true ||
context.isCameraDrivenExternally() === true
this.context?.isInputSuspended() === true ||
this.context?.isCameraDrivenExternally() === true
) {
return;
}
const horizontalMouseLookSign =
context.getRuntimeScene().playerStart?.invertMouseCameraHorizontal === true
this.context.getRuntimeScene().playerStart?.invertMouseCameraHorizontal ===
true
? -1
: 1;
const horizontalMovement = event.movementX * horizontalMouseLookSign;
const targetLookResult =
context.handleRuntimeTargetLookInput?.({
this.context?.handleRuntimeTargetLookInput?.({
horizontal: horizontalMovement,
vertical: -event.movementY
}) ?? null;