# r3f-physics

Guides an AI coding agent through adding Rapier physics to React Three Fiber. Use it for collision-based movement, sensors, forces, and joints.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1800 installs · ★ 130
- Author: EnzeD
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/EnzeD/r3f-skills/tree/HEAD/skills/r3f-physics/SKILL.md
- Updated: 2026-08-31
- HTML: https://affpapa.org/en/nevibecode/skills/r3f-physics

## What it does

The skill covers how to connect Rapier simulation to a React Three Fiber scene. It explains dynamic and fixed bodies, collider choices, impulses and forces, sensor events, joints, and character controllers. It also addresses simulation timing, sleeping bodies, and continuous collision detection.

Check your Fiber, React, and Rapier versions first: Rapier 2 targets Fiber 9 and React 19, while older projects need a compatible package line. Physics loads WASM asynchronously, so examples that use it should be wrapped in `Suspense`. A simulated mesh should not have its position animated with `useFrame`; the physics world can overwrite that change.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-physics -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/r3f-physics/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/r3f-physics/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-physics -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/r3f-physics/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-physics -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/r3f-physics/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install EnzeD/r3f-skills r3f-physics
```

2. **Manually: put the files in place**
- File: `.github/skills/r3f-physics/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-physics -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/EnzeD/r3f-skills --path skills/r3f-physics
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/r3f-physics/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add EnzeD/r3f-skills --skill r3f-physics -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/EnzeD/r3f-skills/tree/HEAD/skills/r3f-physics/SKILL.md

## When to use it
- Set up collisions between bodies and surfaces
- Choose colliders for moving objects and static scenery
- Apply forces at simulation-aligned points
- Handle sensor entry and exit events
- Connect bodies with a joint constraint

## Example prompts
- Add a falling React Three Fiber body that gets an upward impulse when clicked.
- Show me how to configure colliders for moving bodies and a fixed floor.
- Set up Rapier sensor events for objects entering and leaving the sensor.

## Similar
- [orbit-card](https://affpapa.org/en/nevibecode/skills/orbit-card.md) — skill · 10000 installs
- [cad](https://affpapa.org/en/nevibecode/skills/cad.md) — skill · 14000 installs
- [step-parts](https://affpapa.org/en/nevibecode/skills/step-parts.md) — skill · 11200 installs
- [sdf](https://affpapa.org/en/nevibecode/skills/sdf.md) — skill · 10500 installs
- [urdf](https://affpapa.org/en/nevibecode/skills/urdf.md) — skill · 10500 installs
- [hatch-pet](https://affpapa.org/en/nevibecode/skills/hatch-pet.md) — skill · 3300 installs

From the same set: [enzed/r3f-skills](https://affpapa.org/en/nevibecode/by/enzed/r3f-skills.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
