spatial-gestures-interaction

Implements spatial tap, drag, rotate, and magnify gestures on RealityKit entities in visionOS.

Updated Jun 8, 2026
One-click install
npx skills add https://github.com/likw99/agent-plugins --skill spatial-gestures-interaction-likw99
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: spatial-gestures-interaction
Source: https://github.com/likw99/agent-plugins/tree/main/plugins/build-visionos-apps/skills/spatial-gestures-interaction
Command: npx skills add https://github.com/likw99/agent-plugins --skill spatial-gestures-interaction-likw99

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Making 3D content interactive on visionOS fails silently when entities lack input targets or collision shapes, and developers often misapply gesture transforms or misunderstand the eye/hand privacy model. This Skill provides the correct patterns for wiring SwiftUI gestures to RealityKit entities. ## Core Features & Use Cases - Entity-Targeted Gestures: Attach SpatialTapGesture, DragGesture, RotateGesture3D, and MagnifyGesture to RealityView entities using targetedToAnyEntity or targetedToEntity. - Hover Feedback: Add HoverEffectComponent or SwiftUI hoverEffect for look-and-pointer feedback without accessing raw gaze data. - Correct Transform Handling: Capture start transforms and apply deltas so drag, rotate, and scale interactions stay smooth without jumps. - Use Case: Build a manipulable 3D model viewer where users tap to select an entity, drag to move it, rotate it with two hands, and pinch to scale it, all with hover highlighting. ## Quick Start Use the spatial-gestures-interaction skill to make my RealityKit entities respond to tap, drag, rotate, and magnify gestures with hover feedback.

Frequently Asked Questions about spatial-gestures-interaction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add gestures to RealityKit entities in visionOS?▼

Attach SwiftUI gestures like SpatialTapGesture or DragGesture to a RealityView and chain targetedToAnyEntity or targetedToEntity. The entity must have an InputTargetComponent and a collision shape, typically via generateCollisionShapes, or the gesture never fires.

Why is my visionOS gesture not working on an entity?▼

The most common cause is a missing InputTargetComponent or missing collision shape on the entity. Set entity.components.set(InputTargetComponent()) and call generateCollisionShapes(recursive: true); without both, gestures silently do nothing.

How do I drag a RealityKit entity smoothly in visionOS?▼

Capture the entity's starting position in @State when the drag begins, convert the gesture's translation3D into the parent coordinate space with value.convert, and apply the delta to the start position. Reset the stored state in onEnded to avoid jumps.

Can I read the user's gaze position in a visionOS app?▼

No, raw gaze is private by design on visionOS. The system resolves the looked-at target and applies hover effects itself; your code only learns what was interacted with through gestures, never gaze direction or position.

What is the difference between gestures and hand tracking on visionOS?▼

Gestures like pinch and tap arrive as input events targeted at entities and need no special permissions. Raw hand tracking with joint positions requires ARKit's HandTrackingProvider, a Full Space, and user authorization, and should only be used when joint data is genuinely needed.