# Norway flight cinema

Latest flight demo: [fly-cinema.html](../fly-cinema.html). Real locally cached Norway elevation, dual views, sound FX, and impact-driven breakup. See [cinema/README.md](cinema/README.md) for provenance, validation, and crash-model limitations. Earlier demos below are preserved.

# Neural lab update

The demo now includes a live 3D circuit view, individual-neuron stimulation, target-driven motor stimulation, range tests and a trainable adapter. Open the two lab buttons in the neural controls. See [LEARNING.md](LEARNING.md) for usage, the reproducible 50.1% held-out tracking-error reduction and the distinction between adapter learning and fixed brain weights. Aircraft physics remains disconnected.

# Flyfly 3D cockpit prototype

An interactive neural-control cockpit using the exact F-16 OBJ, MTL and textures copied from the requested simulator, with Desktop Fly's existing fly geometry and two neural circuit extracts.

**Current version: neural control (September 11, 2026).** Read [NEURAL-CONTROL.md](NEURAL-CONTROL.md) for the causal pathway, assumptions, tests and data licenses. Neural pilot is active by default; Direct pose retains the original manual demonstration.

## Open the demo

Published demo directory: `~/agent-web/flyfly/cockpit-3d/`.

Open `cockpit-3d/` under your existing agent-web URL. To serve the source locally, run `python -m http.server 8015 --directory flyfly` from the workspace root, then open `http://localhost:8015/cockpit-3d/`. Serve over HTTP; ES modules and textures are not designed for a `file://` launch. All runtime dependencies and textures are included locally; no CDN is required.

## Controls

- Drag to orbit, scroll to zoom, right-drag to pan. Touch orbit/pinch uses Three.js OrbitControls.
- Camera presets: Flight deck, Pilot close-up, Whole aircraft, Overhead.
- In Direct pose mode, pitch and roll sliders move the right front foot and stick. In Neural pilot mode these are disabled readouts.
- Throttle moves the left front foot and lever.
- Animate controls demonstrates manual motion in Direct pose mode only. Editing a slider stops animation. Neural motion has no animation oscillator.
- Center stops animation and centers pitch/roll while retaining throttle.
- Show canopy restores the original canopy-related meshes. Show airframe hides/shows the original plane while leaving the fly cockpit assembly visible.

## Exact source assets and changes

F-16 upstream: https://github.com/kristoffer-dyrkorn/flightsimulator

Revision: `b466fd07c9a201e50206d453f3a31b5b44458850`.

Every file in `assets/f16/` is an unchanged copy of the original `src/f16/` asset. `asset-manifest.json` records SHA-256 hashes. No replacement or approximated airplane mesh is used.

The source OBJ remains untouched. Runtime scene changes hide `Pilot`, `Eject_Seat` and `Glass_HUD`. `Canopy01`, `Glass_Canopy01` and `Glass01` are hidden by default and restored by the canopy toggle. The fuselage, wings, tail and other surface meshes remain original. The new platform and controls are separate geometry, not destructive edits to the aircraft.

Fly upstream: https://github.com/DenisSergeevitch/desktop-fly

Revision: `32b00011e83c3dc85fa3ea0b3934155b04f1635d`.

`fly/model.js` extracts the body/leg geometry section of `windows/src/flymodel.js`, retaining the shape-building code. Imports were reduced to its actual geometry dependencies and Three.js is resolved through the local import map. `fly/legdynamics.js` is copied unchanged. The fly's default root scale is overridden to 1; the entire cockpit assembly is scaled uniformly to fit the original F-16 cabin.

The fly is intentionally cockpit-sized, not an actual millimeter-scale insect inside a full-scale fighter. Its body, eyes, wings and six articulated legs come from Desktop Fly, not the anatomical connectome. The existing aircraft cockpit is low-detail; its original interior surfaces remain visible around the added platform.

## Geometry and control path

The original airplane uses +Y up and +Z toward the nose. The fly's native axes are +Y forward and +Z up. A parent transform maps native fly +X to airplane −X, +Y to airplane +Z and +Z to airplane +Y. The assembly origin is `(0, 2.015, 3.42)` in original OBJ coordinates, with scale `0.021`.

The four support legs use standing poses from Desktop Fly's `SixLegDynamics`. Their feet have individual pads. The front-leg joint rotations are solved analytically against the two control endpoints, preserving femur, tibia and tarsus lengths and the existing fixed ankle bend. RF is leg 0; LF is leg 1. These are virtual attachments, not grasp/contact-force simulation or a biologically constrained inverse-kinematics model.

Neural mode runs the two spiking circuit extracts in a Worker. Their motor activations generate joint torques, which drive a constrained cockpit mechanism; its motion determines the fly's joint poses and readouts. Sensory joint feedback returns to the neural model. In Direct pose mode, sliders instead specify desired control positions and analytical IK fits the legs. These two authority modes remain explicit.

Readouts map pitch to −3…+9 g and roll to ±300°/s, matching nominal simulator command ranges. The aircraft physics and FCS are not running yet. The external stimulation adapter can learn control-target tracking; there is no trained piloting policy. The cockpit assembly remains separate so its measured control coordinates can later connect to the simulator's `InputVector`.

## Validation

The demo was loaded in headless Chromium, with screenshots inspected. Checks cover asset loading, camera presets, canopy and airframe toggles, control animation, finite values, and front-foot alignment across extreme control combinations. The original fit checks are in the workspace's `research/cockpit-3d-check.json`; current neural checks are in `research/cockpit-neural-tests.txt` and `research/cockpit-neural-browser.json`. Run `npm test` for the causal neural/mechanical tests. These checks establish rendering and linkage behavior, not fly physiology or aircraft simulation validity.

## Attribution and license

- F-16 assets copied from Kristoffer Dyrkorn's flight simulator. Its README credits the aircraft model to the Domawe F-16C download: http://www.domawe.net/2015/10/f-16c-fighting-falcon-free-3d-models.html . The upstream simulator uses CC BY-NC-SA 4.0 except separately credited materials; the original model has its own provenance. Preserve those distinctions. See `assets/LICENSE-flightsimulator.txt` and the upstream README.
- Desktop Fly body geometry and mechanics: MIT; original notice in `fly/LICENSE`. The neural version bundles two datasets under separate licenses: female FlyWire circuit CC BY-NC 4.0 and MaleCNS locomotor circuit CC BY 4.0. See `neural/data/DATA_LICENSE.md`.
- Three.js 0.178.0 and its loaders/controls: MIT; notice in `vendor/LICENSE-three`.

This prototype does not relicense the copied source assets or grant additional commercial-use rights.
