# Orb droid

A spherical rolling companion with a separately stabilized head, segmented drive shell, tracking optic, and antenna options.

> 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/orb-droid.json
```

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

## Notes

- Uncontrolled it rolls: the shell turns continuously and the head holds level, which is the mechanism a ball robot is built around. Supply bodyAngle or headAngle and that one channel is yours; supply both and the clock stops.
- A ball is the same circle from every angle, so the body needs no second drawing; the panelling on it is elevation artwork that foreshortens with the camera. The head is a dome, which only reads as one off the front.
- Body and head transforms are independent, so a rolling shell does not drag the stabilized cap around with it.
- Pointer tracking is isolated to this client component and can be disabled or overridden.
- The shell, head and optic carry data-body, data-head and data-optic hooks, so an outer animation loop can drive all three through the DOM without re-rendering the component.

## Usage

```tsx
import { OrbDroid } from "@/components/ui/orb-droid"

<OrbDroid behavior="roll" antenna="twin" />
<OrbDroid bodyAngle={72} headAngle={-18} look={{ x: 0.5, y: -0.2 }} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One droid, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"roll" | "rock" | "survey" | "static"` | `"roll"` | What it does when neither angle is supplied: roll turns the shell and holds the head level, rock stays put, survey sweeps the optic. |
| `speed` | `number` | `0.3` | Cycles per second: one revolution, one rock, one sweep. |
| `bodyAngle` | `number` | — | Controlled rotation of the segmented drive sphere in degrees. Omit to run behavior. |
| `headAngle` | `number` | — | Head steering in degrees, clamped to −65..65. Omit to run behavior. |
| `look` | `Vec2 | null` | `null` | Controlled optic aim in −1..1; overrides pointer tracking. |
| `track` | `boolean` | `true` | Follow the page pointer while look is null. |
| `antenna` | `"single" | "twin" | "none"` | `"twin"` | Communications mast configuration. |
| `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. |
| `showGround` | `boolean` | `true` | Draw the contact line or shadow beneath the droid. |
| `signal` | `"idle" | "ready" | "warning"` | — | Status-lamp state using neutral, accent, or shell colour; each component documents its visual default in the demo. |
| `label` | `string` | — | Optional technical caption under the drawing. |
| `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/orb-droid.tsx`
