# RCWeb Flight App

The **RCWeb Flight App** (`app/flight`) is an advanced 3D aerodynamic flight simulator designed to operate via the **Asymmetric Pattern**. It renders a massive 3D environment while connecting seamlessly with mobile tilt-controllers.

## Screenshot
![screenshot](screenshot.png "Flight App")

## What it does

- **Realistic Aerodynamics**: Employs mathematically complex lift, drag, and sideways-slip physics to govern the model airplane. Lift is uniquely tied directly to the `forwardSpeed` combined with the angle-of-attack, meaning the plane will dynamically stall and crash if maneuvered too slowly.
- **Takeoff Sequence**: The plane spawns locked to a runway with automatically deployed takeoff flaps. It will not become airborne until sufficient speed generates enough Bernoulli lift to break gravity.
- **GLTF Asset Pipeline**: Implements the `THREE.GLTFLoader` to asynchronously stream external `.glb` 3D airplane assets, automatically scaling the boundary boxes, clearing shadows, and mounting it into the flight hierarchy.
- **Procedural Environments**: Populates the terrain with procedural trees, rolling clouds with wind-drift mechanics, and an infinite horizon cylinder. 
- **Particle Systems**: If a crash occurs, it generates an instant 3D particle explosion and thick lingering volumetric smoke trails tracking off the aircraft.

## How it works

The internal frame loop relies heavily on strict Newtonian physics simulations.

- **Thrust & Drag Matrix**: Core flight math runs through `updateFlight()`. It extracts an `effectiveAoA` (Angle of Attack) and `liftEfficiency` factoring in flap angles and stall penalties. The engine calculates active vectors for `thrustForce`, `liftForce`, and `sideForce`, then aggregates these inside a core `acceleration` Vector3.
- **Rotational Rates**: The plane does not magically turn to match the controller. The controller targets supply aerodynamic authority (`pitchAccel`, `yawAccel`, `rollAccel`), which modifies the plane's internal `rollRate/pitchRate` over time, guaranteeing a heavy, realistic momentum-based turning profile constraint by actual air-speed.
- **Damping Interpolation**: Visuals and remote inputs are seamlessly smoothed using exponential decay curves (e.g., `1 - Math.exp(-2.6 * delta)`) ensuring movements feel incredibly fluid. 
