Add mouse camera inversion support and refactor first-person controller context usage

This commit is contained in:
2026-04-27 18:27:58 +02:00
parent f164adf837
commit f165717289
3 changed files with 9 additions and 5 deletions

View File

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