diff --git a/src/document/migrate-scene-document.ts b/src/document/migrate-scene-document.ts index 91c5e328..5bb59a53 100644 --- a/src/document/migrate-scene-document.ts +++ b/src/document/migrate-scene-document.ts @@ -198,6 +198,7 @@ import { PLAYER_START_GAMEPAD_CAMERA_LOOK_SCENE_DOCUMENT_VERSION, PLAYER_START_INTERACT_BINDINGS_SCENE_DOCUMENT_VERSION, PLAYER_START_INPUT_BINDINGS_SCENE_DOCUMENT_VERSION, + PLAYER_START_MOUSE_INVERT_SCENE_DOCUMENT_VERSION, PLAYER_START_TARGETING_SETTINGS_SCENE_DOCUMENT_VERSION, PLAYER_START_NAVIGATION_MODE_SCENE_DOCUMENT_VERSION, PLAYER_START_PAUSE_BINDINGS_SCENE_DOCUMENT_VERSION, diff --git a/src/runtime-three/first-person-navigation-controller.ts b/src/runtime-three/first-person-navigation-controller.ts index 274c7ff1..4517b9d3 100644 --- a/src/runtime-three/first-person-navigation-controller.ts +++ b/src/runtime-three/first-person-navigation-controller.ts @@ -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;