# @ferret/physics-vehicles: API (continued)

### VesselSpec

*interface* · `packages/physics-vehicles/src/vessel.ts:86`

```ts
interface VesselSpec
```

- `mass: number`
- `cog?: Vec3` — centre of gravity of the dry vessel in the body frame, and its principal inertia about it
- `inertia: Vec3`
- `hull?: HullSpec`
- `tanks?: TankSpec[]`
- `compartments?: CompartmentSpec[]`
- `doors?: DoorSpec[]`
- `addedMass?: Vec3` — Added mass: the water the hull drags along when it accelerates, as a share of the water it displaces, per body axis (surge, heave, sway as x, y, z). About 0.05 to 0.2 along a slender hull, near 1 across a flat bottom. It slows the vessel's response and lowers the heave frequency, not its weight.
- `addedInertia?: Vec3` — Added moment of inertia: the water that turns with the hull, as a share per body axis (roll about z, yaw about y, pitch about x as the axes [x, y, z]) of the moment of the displaced water as a block of the hull's size, rho V_sub (b² + c²) / 12. About 0.3 to 1 in roll for a ship.
- `airAddedMass?: Vec3` — Added mass in air (an airship pushes a mass of air about with it, comparable to its own): kg per body axis at sea-level density (surge, heave, sway as x, y, z), scaled with the air density at the altitude. About k·ρ·V of the displaced air: k ≈ 0.05 along a slender hull, ≈ 0.9 across it.
- `airAddedInertia?: Vec3` — the air that turns with the hull, kg·m² per body axis at sea-level density (scaled the same way)
- `envelopes?: EnvelopeSpec[]`
- `thrusters?: ThrusterSpec[]`
- `surfaces?: SurfaceSpec[]`
- `position?: Vec3`
- `orientation?: Quat`
- `velocity?: Vec3`
- `crushDepth?: number` — a hull that breaks below this depth, m
- `hullDrag?: Vec3` — drag on the hull in the water: quadratic coefficient per axis (½ρ·Cd·A, N/(m/s)²) and linear damping (N·s/m), scaled by the submerged share
- `hullDamping?: Vec3`
- `angularDamping?: Vec3` — angular damping in the water, N·m·s/rad per axis, scaled by the submerged share
- `resistance?: HullResistance` — the resistance of a ship's hull from its numbers (Reynolds friction, wave making, appendages, the added resistance of the sea, windage): replaces the surge term of `hullDrag` and `hullDamping`, which stay for sway and heave
- `gravity?: number` — gravity on the vessel's own mass, m/s² (9.80665; zero holds a test vessel up)
- `gauge?: Vec3` — the point the depth gauge reads (body frame; the centre of gravity when missing)

### ZoneSpec

*interface* · `packages/physics-vehicles/src/weapons.ts:14`

```ts
interface ZoneSpec
```

- `absorbed: number`
- `wingPerKg: number`
- `enginePerW: number`
- `tailPerKg: number`
- `crewEnergy: number`
- `fireProb: number`
- `fireTime: number`
- `tnt: number`

## Types

### AeroEvent

*type* · `packages/physics-vehicles/src/aeroplane.ts:92`

```ts
type AeroEvent = | { type: 'touchdown'; sink: number; speed: number; point: string } | { type: 'gear-collapse'; sink: number } | { type: 'break'; part: string; cause: 'overstress' | 'ground' | 'collision' | 'hit' } | { type: 'collision'; other: string; speed: number; parts: string[] } | { type: 'destroyed'; cause: string; speed: number; vertical: number }
```

### HitZone

*type* · `packages/physics-vehicles/src/weapons.ts:39`

```ts
type HitZone = 'engine' | 'wing' | 'tail' | 'crew' | 'fuel' | 'fuselage'
```

### Status

*type* · `packages/physics-vehicles/src/aeroplane.ts:98`

```ts
type Status = 'ok' | 'damaged' | 'destroyed'
```

### VesselEventType

*type* · `packages/physics-vehicles/src/vessel.ts:150`

```ts
type VesselEventType = 'breach' | 'flooded' | 'crushed' | 'surfaced' | 'submerged' | 'capsized'
```

## Constants

### AIRSHIP_ESTIMATES

*const* · `packages/physics-vehicles/src/airship.ts:54`

```ts
const AIRSHIP_ESTIMATES: { kAxial: number; kLateral: number; kRotation: number; cdCross: number; finAspect: number; finInterference: number; flapEffect: number; finStall: number; finCd0: number; propProfile: number; reverseShare: number; rpmRamp: number; }
```

estimated coefficients, one place

### G

*const* · `packages/physics-vehicles/src/vessel.ts:14`

```ts
const G: 9.80665
```

A vessel is one rigid body with parts: a hull that displaces liquid (cells against the water surface), ballast tanks, compartments that
flood through breaches, gas envelopes, thrusters, control surfaces and sails. It integrates its own six degrees of freedom (the light
kernel has no dynamic box and one scalar inertia), reads the water and the air, and reports the readouts a game needs: draft, heel,
trim, metacentric height, depth and buoyancy against weight.

Body axes: x to starboard, y up, z to the bow.

### R_UNIVERSAL

*const* · `packages/physics-vehicles/src/vessel.ts:15`

```ts
const R_UNIVERSAL: 8.314462618
```

### VEHICLES_DEFAULTS

*const* · `packages/physics-vehicles/src/index.ts:25`

```ts
const VEHICLES_DEFAULTS: { waterLevel: number; waterDensity: number; wind: Vec3; }
```

Assemblies of capability V: ships, submarines and balloons. A vessel is one body with parts (a hull, ballast tanks, compartments,
gas envelopes, thrusters, control surfaces and sails) that read the water and the air and write forces. This capability steps them
with the world, moves the scene node that shows each one, and answers the commands a game drives them with.

values (each at world / level / zone / entity scope):
  waterLevel    height of the water surface, m                   (0)
  waterDensity  kg/m³                                            (1000)
  wind          wind velocity at all heights, [x, y, z] m/s       ([0, 0, 0])

events: `vessel:breach`, `vessel:flooded`, `vessel:crushed`, `vessel:surfaced`, `vessel:submerged`, `vessel:capsized`, each { vessel, part? }.

