From build-visionos-apps
Load and compose RealityKit 3D content in visionOS with RealityView, entities, Model3D, and USDZ. Use when displaying 3D models, building scenes from entities, applying materials/transforms/anchors, or bridging SwiftUI to RealityKit.
How this skill is triggered — by the user, by Claude, or both
Slash command
/build-visionos-apps:realitykit-entitiesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
RealityKit is visionOS's 3D engine; `RealityView` bridges SwiftUI to it. Use this
RealityKit is visionOS's 3D engine; RealityView bridges SwiftUI to it. Use this
skill to display 3D models (including generated/downloaded USDZ), build scenes
from entities using the Entity Component System (ECS), and wire transforms,
materials, lighting, and anchors. This is the core of any 3D viewer (e.g. HiPtah's
model viewer / immersive view).
Model3D (SwiftUI).RealityView.Entity(named:in:)
from a Reality Composer Pro RealityKitContent bundle (see reality-composer-pro).Entity(contentsOf: url)
or ModelEntity(contentsOf:), loaded async (see references/loading-usdz.md).import SwiftUI
import RealityKit
struct ModelView: View {
var body: some View {
RealityView { content in // make: async, runs once
let model = try? await ModelEntity(named: "Robot")
if let model { content.add(model) }
} update: { content in // runs on SwiftUI state change
// reconcile entities with state
}
}
}
await model loading there.Entities are containers; behavior comes from components:
Transform / position / orientation / scale — placement.ModelComponent (mesh + materials) — what's drawn.CollisionComponent + InputTargetComponent — required for gestures/hits.HoverEffectComponent — eye/pointer hover highlight.Component + System — your own per-frame logic.let box = ModelEntity(mesh: .generateBox(size: 0.2),
materials: [SimpleMaterial(color: .blue, isMetallic: true)])
box.position = [0, 1.2, -0.5] // meters, +Y up, -Z forward
box.components.set(InputTargetComponent())
box.generateCollisionShapes(recursive: true) // enables hit testing
parent.addChild(box)
visualBounds(relativeTo:).SimpleMaterial, PhysicallyBasedMaterial, UnlitMaterial, or
ShaderGraph materials authored in Reality Composer Pro..mixed immersion, RealityKit uses image-based lighting from the real
environment by default; add an ImageBasedLightComponent or virtual lights for
.full.@State private var phase: LoadPhase = .idle // idle/loading/loaded/failed
RealityView { content in
do {
let entity = try await Entity(contentsOf: usdzURL)
entity.scaleToFit(maxEdge: 0.5) // your helper
content.add(entity)
phase = .loaded
} catch {
phase = .failed(error)
}
}
Always show loading and failure UI — runtime USDZ loads fail (bad file,
unsupported features, network). See references/loading-usdz.md.
Model3D vs RealityView deliberately.InputTargetComponent + collision shapes.update closure is cheap and idempotent (no per-frame allocation/rebuild).references/realityview.md: RealityView make/update/attachments, content API.references/entities-ecs.md: entities, components, systems, transforms, materials.references/loading-usdz.md: loading USDZ/Reality from bundle/disk/network, scaling, errors.RealityView, Model3D, "Composing interactive
3D content with RealityKit and Reality Composer Pro".make closure / Task.update; reconcile existing entities.InputTargetComponent + collision shapes, or gestures silently no-op.State the chosen API, how the model is loaded and scaled, interaction/lighting setup, and how loading/failure states are surfaced.
npx claudepluginhub likw99/agent-plugins --plugin build-visionos-appsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.