aeronautic

Engine

EngineOptions, the Engine class, add_engine and engine_sides.

import { add_engine, engine_sides } from "@aeronautic/controls";

const engines = engine_sides(rig).map((side) => add_engine(rig, { side }));

EngineOptions

optiontypedefaultwhat it does
side"left" | "right" | "centre"every nozzleThe engine on this side.
throttle(flight) => numberthe flight'sIts throttle, 0 idle to 1.1 full reheat.
vectoringboolean | { pitch?, yaw? }on with a gimbalTurn the nozzle with the stick and the pedals. Numbers cap each axis in degrees, or give a model with no gimbal one.
pitch(flight) => numberthe stick'sWhat it vectors for in pitch, −1 to 1, nose up positive.
yaw(flight) => numberthe pedals'What it vectors for in yaw, −1 to 1, nose right positive.
nozzlePartial<NozzleSchedule>0.45, 0, 1How open the petals are at idle, military and reheat.
anchorObject3D | stringits side's exhaust anchorWhere the exhaust leaves.
ratenumber40How fast the gimbal turns, in degrees a second.
onVector(pitchDeg, yawDeg) => void—Called in the frame the nozzle turns, with where the exhaust points: up and right of aft.

Engine

memberwhat it is
rigThe rig.
sideIts side, or null for one that took every nozzle.
anchorWhere its plume goes: the exhaust, or the mount inside a gimbal put in by code.
parts{ pitch, yaw, petals }, its nozzle's parts.
clipThe model's clip that opens its nozzle, if any.
vectoring{ pitch, yaw, shape, gimbal }: limits, ellipse or box, model, virtual or null.
extrasWhat the model says of its gimbal and exhaust, as limit_shape.
throttleIts throttle, a function of the flight, for an afterburner to follow.
pitchDegWhere the exhaust points now, up of aft.
yawDegAnd right of aft.
refresh()Read its options again.
dispose()Stop driving, and take a virtual gimbal out.

add_engine(rig, options) is new Engine(rig, options).

engine_sides(rig) gives the sides with an engine of their own, from the model's nozzle parts and exhaust anchors: ["left", "right"] for a twin, [undefined] for a single engine on the centre line, [] for none.

fighter_controls

fighter_controls(rig, { pitchShare?, engine? }) drives every part and adds an engine for each side. It returns a drive with engines on it.

On this page