# realitykit

A skill for building AR scenes with RealityKit and ARKit: RealityView, anchors, raycasts, gestures. Useful when your iOS app needs 3D content.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3200 installs · ★ 1237
- Author: dpearson2699
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/dpearson2699/swift-ios-skills/tree/HEAD/skills/realitykit/SKILL.md
- Updated: 2026-07-31
- HTML: https://affpapa.org/en/nevibecode/skills/realitykit

## What it does

The skill covers RealityKit and ARKit in one place: how to set up a `RealityView`, load entities and USDZ models, and tether an object to a plane or a world position. Raycasting gets its own section. The author separates two lookalike mechanisms: `ray(through:in:to:)` returns a camera ray in RealityKit coordinate spaces, while `hitTest(point:in:query:mask:)` hits entities made hittable by `CollisionComponent`. Intersecting a real surface takes an ARKit `ARRaycastQuery` plus `ARSession.raycast(_:)`, then an anchor via `AnchorEntity(raycastResult:)`. Mix those up and your object lands in empty space — worth checking before you test on a device.

Inside are sections on project setup, creating and loading entities, anchoring, gestures, scene understanding, along with a common mistakes list and a review checklist. Targets are Swift 6.3 and iOS 26+. Basic AR needs no extra entitlement, but Info.plist must carry `NSCameraUsageDescription`. Before showing AR UI, the skill advises checking `ARWorldTrackingConfiguration.isSupported` and keeping a fallback: `content.camera = .virtual`.

Entities follow ECS here, so behaviour and interactivity come from components — `PhysicsBodyComponent`, `CollisionComponent`, `InputTargetComponent`. Without the last one, a gesture on an entity does nothing.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill realitykit -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill realitykit -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill realitykit -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dpearson2699/swift-ios-skills realitykit
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill realitykit -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/realitykit
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dpearson2699/swift-ios-skills --skill realitykit -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/dpearson2699/swift-ios-skills/tree/HEAD/skills/realitykit/SKILL.md

## When to use it
- build an AR scene with RealityView in SwiftUI
- load a USDZ model and place it in the scene
- anchor an object to a floor or wall with AnchorEntity
- tell when to use hitTest versus an ARKit raycast
- add gestures and physics to entities through components

## Example prompts
- Set up a RealityView screen and show a blue sphere 50cm in front of the camera
- Load the robot USDZ model and anchor it to a horizontal floor plane
- My entity ignores taps — check whether it has an InputTargetComponent

## Similar
- [mcp](https://affpapa.org/en/nevibecode/mcp/sceneview-mcp.md) — MCP server · ★ 1348
- [fal-3d](https://affpapa.org/en/nevibecode/skills/fal-3d.md) — skill · 2800 installs
- [aframe-webxr](https://affpapa.org/en/nevibecode/skills/aframe-webxr.md) — skill · 2300 installs
- [axiom-graphics](https://affpapa.org/en/nevibecode/skills/axiom-graphics.md) — skill · 1200 installs
- [axiom-games](https://affpapa.org/en/nevibecode/skills/axiom-games.md) — skill · 1100 installs
- [xcode-project-setup](https://affpapa.org/en/nevibecode/skills/xcode-project-setup.md) — skill · 130700 installs

From the same set: [dpearson2699/swift-ios-skills](https://affpapa.org/en/nevibecode/by/dpearson2699/swift-ios-skills.md) — 86 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
