# FlightCommand

> Talos next · Since next

What {@link EntityHandle.fly} asks of a multirotor.

A field left out keeps what it flew.

## Signature

```ts
export interface FlightCommand {
  /** `rate` (acro), `angle` (holds level, heading, altitude) or `velocity` (also holds its point). */
  mode?: "rate" | "angle" | "velocity"
  /** Climb (+) or descent (-) as a share of the limits; in rate mode the throttle, 0..1. */
  lift?: number
  /** Turn rate, +1 left. */
  yaw?: number
  /** +1 forward: a tilt, a rate or a speed, by mode. */
  pitch?: number
  /** +1 right. */
  roll?: number
  /** Velocity mode: a world velocity, m/s, in place of the sticks; null clears it. */
  velocity?: Vec3 | null
  /** Disarmed motors stop and the controller forgets what it held. */
  armed?: boolean
}
```

Import: `import type { FlightCommand } from "@argus/api"`

## Members

| Member | Signature | Description |
|---|---|---|
| `mode` | `mode?: "rate" \| "angle" \| "velocity"` | `rate` (acro), `angle` (holds level, heading, altitude) or `velocity` (also holds its point). |
| `lift` | `lift?: number` | Climb (+) or descent (-) as a share of the limits; in rate mode the throttle, 0..1. |
| `yaw` | `yaw?: number` | Turn rate, +1 left. |
| `pitch` | `pitch?: number` | +1 forward: a tilt, a rate or a speed, by mode. |
| `roll` | `roll?: number` | +1 right. |
| `velocity` | `velocity?: Vec3 \| null` | Velocity mode: a world velocity, m/s, in place of the sticks; null clears it. |
| `armed` | `armed?: boolean` | Disarmed motors stop and the controller forgets what it held. |

## Example

The tested fixture `fixtures/host/door.ts`.

```ts
import type { Behavior } from "@argus/api"
// docs/API.md, "Joints": a door on a hinge that swings open while the player is near and closes
// behind them. Typechecked by packages/api's tests.
export default {
  update(ctx) {
    const player = ctx.world.find("player")
    const near = player !== null && ctx.entity.distanceTo(player) < 2
    ctx.joint?.setMotor(near ? Math.PI / 2 : 0, { mode: "position", maxForce: 200 })
  },
} satisfies Behavior
```
