# Tanker truck

A tractor unit and a road tanker on one kingpin. Steer the front axle and the trailer's yaw is solved, not chosen — so it off-tracks inside the tractor's line, and the barrel foreshortens in side elevation as it turns.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/tanker-truck.json
```

Registry item: `tanker-truck` · [`https://robocn.dev/r/tanker-truck.json`](https://robocn.dev/r/tanker-truck.json)

## Notes

- Solved: the two steer-wheel angles from `ackermann()`, and the articulation angle from `hitchAngle()` — the kingpin rides a circle of its own and the bogie cannot slide sideways, which fixes the angle between the units. It is a steady state with no history, so a truck that has been round a corner comes out of it straight.
- The yaw is a real rotation about the kingpin's vertical axis in world space, not a rotation of the drawing, so the bogie goes round with the barrel instead of staying behind.
- The barrel is opaque, so each compartment's contents are read off the cabinet gauges and its dome collar rather than drawn through the shell.
- No suspension, mass, load transfer or fluid is computed, and nothing accumulates where it has driven.

## Usage

```tsx
import { TankerTruck } from "@/components/ui/tanker-truck"

<TankerTruck behavior="haul" compartments={5} />

// Manoeuvre is the behaviour that gives the hitch something to solve.
<TankerTruck behavior="manoeuvre" view="plan" />

// A pinned hitch overrides the solution.
<TankerTruck level={0.4} hitch={30} view="plan" />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `level` | `number` | — | Controlled cargo, 0 empty to 1 full. Supplying it stops the loop. |
| `behavior` | `"haul" | "discharge" | "manoeuvre" | "static"` | `"haul"` | Rolling with a full barrel, a delivery round emptying a compartment at a time, or a yard manoeuvre that works the articulation. |
| `compartments` | `number` | `4` | Bulkheaded compartments, which discharge from the rear. Clamped to 2–6. |
| `steer` | `number` | — | Front-axle steering in degrees, positive to starboard, clamped to ±26 — past that the kingpin’s circle closes inside the trailer’s wheelbase and there is no steady articulation to solve for. Omit it and the behaviour drives the rack. |
| `hitch` | `number` | — | Trailer yaw about the kingpin in degrees, clamped to ±60. Omit it and it is solved from the steer; supply it and the solution is overridden. |
| `showCabinet` | `boolean` | `true` | The discharge cabinet, the hose reel, and a gauge per compartment. |
| `showGround` | `boolean` | `true` | The carriageway and its lane markings, which run with the road speed. |
| `interactive / onLevelChange` | `boolean / (level: number) => void` | — | Drag or arrow-key the load in and out. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One road tanker, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/tanker-truck.tsx`
