aeronautic

ControlRig

The rig: its parts, its drives, its clips, and moving it by hand.

import { ControlRig } from "@aeronautic/controls";

const rig = new ControlRig(gltf.scene, {
  animations: gltf.animations,
  source: flight,
});

ControlRigOptions

optiontypedefaultwhat it does
animationsAnimationClip[]—The clips, scrubbed by driveClip or setClip.
sourceFlight | nullnullThe flight its drives read. null moves only what is set by hand.
ratesPartial<ControlRates>—How fast each kind moves, over the defaults.
settlebooleantrueJump to the flight's pose on the first read.
rigbooleantrueRead CTRL_ nodes' extras.
namesbooleantrueFind parts by name where there is no rig. It changes the scene graph.
filter(node: Object3D) => boolean—Leave nodes out.
forward, up[x, y, z]-Z, +YWhich way the model faces.

Members

memberwhat it is
rootThe model.
surfacesEvery part found.
anchorsEvery anchor found.
clipsThe clips, by name: { clip, action }.
sourceThe flight read. Writable.
ratesThe rate of each kind. Call refresh() after writing it.
surface(name)A part by name.
anchor(name)An anchor by name.
value(name)Where a part is now, in its unit.
drive(options)Add a drive. Returns a ControlDrive.
driveClip(options)Add a clip's drive. Returns a ControlDrive.
set(name, value)Move a part by hand, in its unit, clamped. null gives it back.
setGroup(group, share)Move a rig group, or a kind, by hand, 0 to 1 of its travel. null gives it back.
setClip(name, share, rate?)Scrub a clip by hand, 0 to 1, at rate shares a second or the clip's own. null gives it back.
onMoved(listener)Called after anything moved, once a frame at most. Returns what stops it.
addSurface(surface)Add a part made by code.
removeSurface(name)Take a part away.
refresh()Read every drive's options again.
update(delta_s)Move everything one frame on.
dispose()Stop the clips. The parts stay where they are.

DriveOptions

Which parts, and where each should be.

optiontypewhat it does
partsstring[]The parts by name.
groupstringA rig group, as elevons.
kindsSurfaceKind[]Kinds of part, as ["aileron"].
side"left" | "right" | "centre"Narrows any of them.
filter(part) => booleanKeep only the parts this passes.
from(flight, part) => number | nullWhere the part should be, in its unit, clamped. null leaves it.
ratenumberIn the part's unit a second, over the rig's rate for its kind.
onMove(value, part) => voidCalled in the frame a part moves.

With none of parts, group and kinds, a drive is for every part.

ClipDriveOptions

optiontypewhat it does
clipstring | RegExpThe clip, by name or a pattern its name matches.
side"left" | "right" | "centre"Only the clips whose name says this side.
from(flight, clip) => number | nullHow far through, 0 to 1. null leaves it.
ratenumberShares of the clip a second. By default, the clip's own time.
onMove(position, clip) => voidCalled in the frame it moves.

ControlDrive

memberwhat it does
partsThe parts it claimed, whether or not a more specific drive won them.
refresh()Read its options again.
dispose()Stop: its parts go to the next drive that claims them, or rest.

Rates

default_control_rates, in each kind's unit a second:

kindrate
aileron, rudder, spoiler80
elevator, elevon, stabilator, canard60
drag_rudder, gear_door60
airbrake40
nozzle_pitch, nozzle_yaw40
le_flap30
gear30
nozzle_petal20
flap10
levers, stick, pedals, otherInfinity

selects(select, part) says whether a DriveSelect takes a part.

On this page