import { type AnalogMoveIntent, type CollisionObstacle, type MovementKeysState, type MotionFrameOptions } from "./movementModel.js"; import { type AxisBinding } from "../input/axisInput.js"; import type { PointerAxisState } from "../input/pointerAxis.js"; import type { ChaseCameraTuning } from "../runtime/cameraDirector.js"; /** Free-flight families — character-scale 6DOF movement, distinct from vehicle aerodynamics. */ export type FreeFlightMode = "creative" | "spectator" | "noclip" | "hover"; /** Per-axis bindings for free-flight — which actions drive each flight axis. Positive is forward/right/up. */ export interface FreeFlightBindings { /** Forward/back — default `moveForward` / `moveBack` (W/S). */ forward?: AxisBinding; /** Strafe right/left — default `moveRight` / `moveLeft` (D/A). */ strafe?: AxisBinding; /** Ascend/descend — default `jump` / `crouch` (Space / Ctrl+C). */ vertical?: AxisBinding; /** Sprint — default `sprint` (Shift) held. */ sprint?: AxisBinding; } /** Data-first tuning for one free-flight profile. */ export interface FreeFlightTuning { mode: FreeFlightMode; /** Horizontal base speed (units/s) before sprint. Default 8. */ speed?: number; /** Vertical base speed for ascend/descend. Default = `speed`. */ verticalSpeed?: number; /** Sprint multiplier while shift is held. Default 1.8. */ sprintMultiplier?: number; /** Lerp rate toward target velocity. Default 20. */ acceleration?: number; /** Extra damping applied when no input (0 = rely on lerp). Default 0. */ damping?: number; /** Downward acceleration for hover mode. Default 0 (weightless). */ gravity?: number; /** Upward thrust acceleration while ascending in hover. Default 32. */ thrust?: number; /** When true, forward moves along the look pitch (spectator). Default false. */ alignWithLook?: boolean; /** Top vertical fall speed in hover. Default 20. */ maxFallSpeed?: number; /** Whether to slide against world solids. Default true for creative/hover, false for spectator/noclip. */ collide?: boolean; /** Axis bindings for this flight profile — which actions drive each axis. Unlisted axes keep the defaults above. */ bindings?: FreeFlightBindings; /** Camera POV while this flight is active — chase tuning overlay applied on mount, cleared on dismount. Null clears. */ camera?: ChaseCameraTuning | null; } /** Velocity state for a free-flight actor — serializable and ownable by the caller. */ export interface FreeFlightState { vx: number; vy: number; vz: number; } /** Intent for one free-flight tick — forward/right from WASD/analog, vertical from jump/crouch. */ export interface FreeFlightIntent { forward: number; right: number; vertical: number; sprint: boolean; moving: boolean; } /** World displacement produced by one free-flight tick. */ export interface FreeFlightStep { stepX: number; stepY: number; stepZ: number; } /** Stateful handle for any free-flight actor with snapshot/restore/retune. */ export interface FreeFlightController { tick(dt: number, intent: FreeFlightIntent, yaw: number, pitch?: number): FreeFlightStep; velocity(): readonly [number, number, number]; snapshot(): FreeFlightState; restore(next: FreeFlightState): void; retune(next: FreeFlightTuning): void; reset(): void; } /** Create an empty flight velocity state. */ export declare function createFreeFlightState(): FreeFlightState; /** * Translate held keys + analog into a free-flight intent. * Vertical is `space - (control|c)` so jump ascends and crouch descends — the same * keys that walk/jump/crouch use, re-mapped for flight without re-binding. */ export declare function resolveFreeFlightIntent(keys: MovementKeysState, analog: AnalogMoveIntent | null | undefined): FreeFlightIntent; /** * Translate live input (held actions + analog + pointer) into a flight intent using * per-profile axis bindings. Unlisted bindings fall back to the defaults above so * existing games keep WASD/Space/Ctrl/Shift without declaring anything. */ export declare function resolveFreeFlightIntentFromInput(isDown: (action: string) => boolean, value: (action: string) => number, pointer: PointerAxisState | null, bindings?: FreeFlightBindings): FreeFlightIntent; /** * Advance one frame of free-flight kinematics. * Horizontal uses yaw-relative strafe (A = left, D = right) — never roll/bank. * Vertical is independent of pitch unless `alignWithLook` is true (spectator). */ export declare function advanceFreeFlight(state: FreeFlightState, intent: FreeFlightIntent, yaw: number, pitch: number | undefined, dt: number, tuning: FreeFlightTuning, options?: Pick): FreeFlightStep; /** Resolve a flight step against world solids (XZ slide + Y clamp). */ export declare function resolveFlightStep(position: readonly [number, number, number], stepX: number, stepY: number, stepZ: number, obstacles: readonly CollisionObstacle[], radius?: number): { stepX: number; stepY: number; stepZ: number; }; /** * Totally free flight for any actor — character, camera, drone, or debug rig. * Horizontal is always yaw-relative strafe; vertical is jump/crouch. Use `alignWithLook` * for a 6DOF spectator that flies where the camera looks. * @capability free-flight camera-relative creative/spectator/noclip/hover flight with correct strafe, sprint, and optional gravity */ export declare function createFreeFlightController(initialTuning: FreeFlightTuning, options?: { yaw?: number; pitch?: number; state?: FreeFlightState; }): FreeFlightController; /** Preset for Minecraft-like creative flight — weightless, collides, yaw-relative strafe. */ export declare const CREATIVE_FLIGHT_TUNING: FreeFlightTuning; /** Preset for spectator — weightless, noclips, flies where the camera looks. */ export declare const SPECTATOR_FLIGHT_TUNING: FreeFlightTuning; /** Preset for noclip — weightless, noclips, yaw-relative with independent vertical. */ export declare const NOCLIP_FLIGHT_TUNING: FreeFlightTuning; /** Preset for hover/jetpack — gravity + thrust, useful for short bursts. */ export declare const HOVER_FLIGHT_TUNING: FreeFlightTuning;