# Mecanum wheel

The wheel that lets a base drive sideways: barrel rollers set at 45° out of the wheel plane, in a left hand and a right hand.

> 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/mecanum-wheel.json
```

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

## Notes

- The rollers are modelled rather than drawn: each barrel's axis is tilted 45° out of the wheel plane toward the rim tangent, and both of its ends go through the shared camera. That is why flipping the hand reverses the skew and why the part reads best in iso.
- Roller spin is not solved. A mecanum roller turns from contact with the floor, and there is no floor here — only the hub angle is driven.

## Usage

```tsx
import { MecanumWheel } from "@/components/ui/mecanum-wheel"

<MecanumWheel hand="left" rollers={9} view="iso" />

// Controlled, or a hub you can spin.
<MecanumWheel angle={120} />
<MecanumWheel interactive onAngleChange={setAngle} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One wheel, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `angle` | `number` | — | Controlled hub angle in degrees. Omit it and the hub runs behavior. |
| `behavior` | `"roll" | "crab" | "static"` | `"roll"` | Roll continuously, or reverse each half cycle the way a corner drives when the base goes sideways. |
| `speed` | `number` | `0.3` | Hub turns per second rolling, or crab cycles per second. |
| `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. |
| `interactive` | `boolean` | `false` | Drag round the hub to spin it, or arrow-key it 10° at a time. |
| `onAngleChange` | `(angle: number) => void` | — | Hub angle, wrapped to 0–360, whenever a person moves it. |
| `hand` | `"left" | "right"` | `"right"` | Which way the rollers lean. A holonomic base needs one of each per axle. |
| `rollers` | `number` | `9` | Barrel rollers round the rim, rounded and clamped to 6–14. |
| `showHub` | `boolean` | `true` | Draw the hub, spokes and stub axle inside the rollers. |
| `label` | `string` | — | Caption below the hand and roller readout. |
| `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/mecanum-wheel.tsx`
