[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E6KWJZ8K3R208FP6SS752G":3,"skill-same:01M6E6KWJZ8K3R208FP6SS752G":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":26,"linkOnly":27,"markdownContent":28,"markdownBody":29,"frontMatter":30,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":38,"ownerHtmlUrl":39,"ownerBlogUrl":6,"ownerDescription":40,"updatedAt":41,"install":42,"resources":55},"01M6E6KWJZ8K3R208FP6SS752G","axiom-realitykit-diag",null,"Use when RealityKit entities not visible, anchors not tracking, gestures not responding, performance drops, materials wrong, or multiplayer sync fails","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-realitykit-diag\u002FSKILL.md",[],[19,20,21,22,23,24,25],"axiom realitykit diag","performance","gestures","sync","multiplayer","tracking","use","2026-11-10 10:12:30",false,"---\nname: axiom-realitykit-diag\ndescription: Use when RealityKit entities not visible, anchors not tracking, gestures not responding, performance drops, materials wrong, or multiplayer sync fails\nlicense: MIT\nmetadata:\n  version: \"1.0.0\"\n---\n\n# RealityKit Diagnostics\n\nSystematic diagnosis for common RealityKit issues with time-cost annotations.\n\n## When to Use This Diagnostic Skill\n\nUse this skill when:\n- Entity added but not visible in the scene\n- AR anchor not tracking or content floating\n- Tap\u002Fdrag gestures not responding on 3D entities\n- Frame rate dropping or stuttering\n- Material looks wrong (too dark, too bright, incorrect colors)\n- Multiplayer entities not syncing across devices\n- Physics bodies not colliding or passing through each other\n\nFor RealityKit architecture patterns and best practices, see `axiom-realitykit`. For API reference, see `axiom-realitykit-ref`.\n\n---\n\n## Mandatory First Step: Enable Debug Visualization\n\n**Time cost**: 10 seconds vs hours of blind debugging\n\n```swift\n\u002F\u002F In your RealityView or ARView setup\n#if DEBUG\n\u002F\u002F Xcode: Debug → Attach to Process → Show RealityKit Statistics\n\u002F\u002F Or enable in code:\narView.debugOptions = [\n    .showStatistics,       \u002F\u002F Entity count, draw calls, FPS\n    .showPhysics,          \u002F\u002F Collision shapes\n    .showAnchorOrigins,    \u002F\u002F Anchor positions\n    .showAnchorGeometry    \u002F\u002F Detected plane geometry\n]\n#endif\n```\n\nIf you can't see collision shapes with `.showPhysics`, your `CollisionComponent` is missing or misconfigured. **Fix collision before debugging gestures or physics.**\n\n---\n\n## Symptom 1: Entity Not Visible\n\n**Time saved**: 30-60 min → 2-5 min\n\n```\nEntity added but nothing appears\n│\n├─ Is the entity added to the scene?\n│   └─ NO → Add to RealityView content:\n│        content.add(entity)\n│        ✓ Entities must be in the scene graph to render\n│\n├─ Does the entity have a ModelComponent?\n│   └─ NO → Add mesh and material:\n│        entity.components[ModelComponent.self] = ModelComponent(\n│            mesh: .generateBox(size: 0.1),\n│            materials: [SimpleMaterial(color: .red, isMetallic: false)]\n│        )\n│        ✓ Bare Entity is invisible — it's just a container\n│\n├─ Is the entity's scale zero or nearly zero?\n│   └─ CHECK → Print: entity.scale\n│        USD models may import with unexpected scale.\n│        Try: entity.scale = SIMD3(repeating: 0.01) for meter-scale models\n│\n├─ Is the entity behind the camera?\n│   └─ CHECK → Print: entity.position(relativeTo: nil)\n│        In RealityKit, -Z is forward (toward screen).\n│        Try: entity.position = SIMD3(0, 0, -0.5) (half meter in front)\n│\n├─ Is the entity inside another object?\n│   └─ CHECK → Move to a known visible position:\n│        entity.position = SIMD3(0, 0, -1)\n│\n├─ Is the entity's isEnabled set to false?\n│   └─ CHECK → entity.isEnabled = true\n│        Also check parent: entity.isEnabledInHierarchy\n│\n├─ Is the entity on an untracked anchor?\n│   └─ CHECK → Verify anchor is tracking:\n│        entity.isAnchored (should be true)\n│        If using plane anchor, ensure surface is detected first\n│\n└─ Is the material transparent or OcclusionMaterial?\n    └─ CHECK → Inspect material:\n         If using PhysicallyBasedMaterial, check baseColor is not black\n         If using blending = .transparent, check opacity > 0\n```\n\n### Quick Diagnostic\n\n```swift\nfunc diagnoseVisibility(_ entity: Entity) {\n    print(\"Name: \\(entity.name)\")\n    print(\"Is enabled: \\(entity.isEnabled)\")\n    print(\"In hierarchy: \\(entity.isEnabledInHierarchy)\")\n    print(\"Is anchored: \\(entity.isAnchored)\")\n    print(\"Position (world): \\(entity.position(relativeTo: nil))\")\n    print(\"Scale: \\(entity.scale)\")\n    print(\"Has model: \\(entity.components[ModelComponent.self] != nil)\")\n    print(\"Children: \\(entity.children.count)\")\n}\n```\n\n---\n\n## Symptom 2: Anchor Not Tracking\n\n**Time saved**: 20-45 min → 3-5 min\n\n```\nAR content not appearing or floating\n│\n├─ Is the AR session running?\n│   └─ For RealityView on iOS 18+, AR runs automatically\n│       For ARView, check: arView.session.isRunning\n│\n├─ Is SpatialTrackingSession configured? (iOS 18+)\n│   └─ CHECK → Ensure tracking modes requested:\n│        let config = SpatialTrackingSession.Configuration(\n│            tracking: [.plane, .object])\n│        let result = await session.run(config)\n│        if let notSupported = result {\n│            \u002F\u002F Handle unsupported modes\n│        }\n│\n├─ Is the anchor type appropriate for the environment?\n│   ├─ .plane(.horizontal) → Need a flat surface visible to camera\n│   ├─ .plane(.vertical) → Need a wall visible to camera\n│   ├─ .image → Image must be in \"AR Resources\" asset catalog\n│   ├─ .face → Front camera required (not rear)\n│   └─ .body → Full body must be visible\n│\n├─ Is minimumBounds too large?\n│   └─ CHECK → Reduce minimum bounds:\n│        AnchorEntity(.plane(.horizontal, classification: .any,\n│            minimumBounds: SIMD2(0.1, 0.1)))  \u002F\u002F Smaller = detects sooner\n│\n├─ Is the device supported?\n│   └─ CHECK → Plane detection requires A12+ chip\n│       Face tracking requires TrueDepth camera\n│       Body tracking requires A12+ chip\n│\n└─ Is the environment adequate?\n    └─ CHECK → AR needs:\n         - Adequate lighting (not too dark)\n         - Textured surfaces (not blank walls)\n         - Stable device position during initial detection\n```\n\n---\n\n## Symptom 3: Gesture Not Responding\n\n**Time saved**: 15-30 min → 2-3 min\n\n```\nTap\u002Fdrag on entity does nothing\n│\n├─ Does the entity have a CollisionComponent?\n│   └─ NO → Add collision shapes:\n│        entity.generateCollisionShapes(recursive: true)\n│        \u002F\u002F or manual:\n│        entity.components[CollisionComponent.self] = CollisionComponent(\n│            shapes: [.generateBox(size: SIMD3(0.1, 0.1, 0.1))])\n│        ✓ Collision shapes are REQUIRED for gesture hit testing\n│\n├─ [visionOS] Does the entity have InputTargetComponent?\n│   └─ NO → Add it:\n│        entity.components[InputTargetComponent.self] = InputTargetComponent()\n│        ✓ Required on visionOS for gesture input\n│\n├─ Is the gesture attached to the RealityView?\n│   └─ CHECK → Gesture must be on the view, not the entity:\n│        RealityView { content in ... }\n│            .gesture(TapGesture().targetedToAnyEntity().onEnded { ... })\n│\n├─ Is the collision shape large enough to hit?\n│   └─ CHECK → Enable .showPhysics to see shapes\n│        Shapes too small = hard to tap.\n│        Try: .generateBox(size: SIMD3(repeating: 0.1)) minimum\n│\n├─ Is the entity behind another entity?\n│   └─ CHECK → Front entities may block gestures on back entities\n│        Ensure collision is on the intended target\n│\n└─ Is the entity enabled?\n    └─ CHECK → entity.isEnabled must be true\n         Disabled entities don't receive input\n```\n\n### Quick Diagnostic\n\n```swift\nfunc diagnoseGesture(_ entity: Entity) {\n    print(\"Has collision: \\(entity.components[CollisionComponent.self] != nil)\")\n    print(\"Has input target: \\(entity.components[InputTargetComponent.self] != nil)\")\n    print(\"Is enabled: \\(entity.isEnabled)\")\n    print(\"Is anchored: \\(entity.isAnchored)\")\n\n    if let collision = entity.components[CollisionComponent.self] {\n        print(\"Collision shapes: \\(collision.shapes.count)\")\n    }\n}\n```\n\n---\n\n## Symptom 4: Performance Problems\n\n**Time saved**: 1-3 hours → 10-20 min\n\n```\nFrame rate dropping or stuttering\n│\n├─ How many entities are in the scene?\n│   └─ CHECK → Print entity count:\n│        var count = 0\n│        func countEntities(_ entity: Entity) {\n│            count += 1\n│            for child in entity.children { countEntities(child) }\n│        }\n│        Under 100: unlikely to be entity count\n│        100-500: review for optimization\n│        500+: definitely needs optimization\n│\n├─ Are mesh\u002Fmaterial resources shared?\n│   └─ NO → Share resources across identical entities:\n│        let sharedMesh = MeshResource.generateBox(size: 0.05)\n│        let sharedMaterial = SimpleMaterial(color: .white, isMetallic: false)\n│        \u002F\u002F Reuse for all instances\n│        ✓ RealityKit batches entities with identical resources\n│\n├─ Is a System creating components every frame?\n│   └─ CHECK → Look for allocations in update():\n│        Creating ModelComponent, CollisionComponent, or materials\n│        every frame causes GC pressure.\n│        Cache resources, only update when values change.\n│\n├─ Are collision shapes mesh-based?\n│   └─ CHECK → Replace generateCollisionShapes(recursive: true)\n│        with simple shapes (box, sphere, capsule) for dynamic entities\n│\n├─ Is generateCollisionShapes called repeatedly?\n│   └─ CHECK → Call once during setup, not every frame\n│\n├─ Are there too many physics bodies?\n│   └─ CHECK → Dynamic bodies are most expensive.\n│        Convert distant\u002Fstatic objects to .static mode.\n│        Remove physics from non-interactive entities.\n│\n└─ Is the model polygon count too high?\n    └─ CHECK → Decimate models for real-time use.\n         Target: \u003C100K triangles total for mobile AR.\n         Use LOD (Level of Detail) for distant objects.\n```\n\n---\n\n## Symptom 5: Material Looks Wrong\n\n**Time saved**: 15-45 min → 5-10 min\n\n```\nColors, lighting, or textures look incorrect\n│\n├─ Is the scene too dark?\n│   └─ CHECK → Missing environment lighting:\n│        Add DirectionalLightComponent or EnvironmentResource\n│        In AR, RealityKit uses real-world lighting automatically\n│        In non-AR, you must provide lighting explicitly\n│\n├─ Is the baseColor set?\n│   └─ CHECK → PhysicallyBasedMaterial defaults to white\n│        material.baseColor = .init(tint: .red)\n│        If using a texture, verify it loaded:\n│        try TextureResource(named: \"albedo\")\n│\n├─ Is metallic set incorrectly?\n│   └─ CHECK → metallic = 1.0 makes surfaces mirror-like\n│        Most real objects: metallic = 0.0\n│        Only metals (gold, silver, chrome): metallic = 1.0\n│\n├─ Is the texture semantic wrong?\n│   └─ CHECK → Use correct semantic:\n│        .color for albedo\u002FbaseColor textures\n│        .raw for data textures (metallic, roughness)\n│        .normal for normal maps\n│        .hdrColor for HDR textures\n│\n├─ Is the model upside down or inside out?\n│   └─ CHECK → Try:\n│        material.faceCulling = .none (shows both sides)\n│        If that fixes it, the model normals are flipped\n│\n└─ Is blending\u002Ftransparency unexpected?\n    └─ CHECK → material.blending\n         Default is .opaque\n         For transparency: .transparent(opacity: ...)\n```\n\n---\n\n## Symptom 6: Physics Not Working\n\n**Time saved**: 20-40 min → 5-10 min\n\n```\nObjects pass through each other or don't collide\n│\n├─ Do both entities have CollisionComponent?\n│   └─ NO → Both sides of a collision need CollisionComponent\n│\n├─ Does the moving entity have PhysicsBodyComponent?\n│   └─ NO → Add physics body:\n│        entity.components[PhysicsBodyComponent.self] = PhysicsBodyComponent(\n│            mode: .dynamic)\n│\n├─ Are collision groups\u002Ffilters configured correctly?\n│   └─ CHECK → Entities must be in compatible groups:\n│        Default: group = .default, mask = .all\n│        If using custom groups, verify mask includes the other group\n│\n├─ Is the physics mode correct?\n│   ├─ Two .static bodies → Never collide (both immovable)\n│   ├─ .dynamic + .static → Correct (common setup)\n│   ├─ .dynamic + .dynamic → Both move on collision\n│   └─ .kinematic + .dynamic → Kinematic pushes dynamic\n│\n├─ Is the collision shape appropriate?\n│   └─ CHECK → .showPhysics debug option\n│        Shape may be too small, offset, or wrong type\n│\n└─ Are entities on different anchors?\n    └─ CHECK → \"Physics bodies and colliders affect only\n         entities that share the same anchor\" (Apple docs)\n         Move entities under the same anchor for physics interaction\n```\n\n---\n\n## Symptom 7: Multiplayer Sync Issues\n\n**Time saved**: 30-60 min → 10-15 min\n\n```\nEntities not appearing on other devices\n│\n├─ Does the entity have SynchronizationComponent?\n│   └─ NO → Add it:\n│        entity.components[SynchronizationComponent.self] =\n│            SynchronizationComponent()\n│\n├─ Is the MultipeerConnectivityService set up?\n│   └─ CHECK → Verify MCSession is connected before syncing\n│\n├─ Are custom components Codable?\n│   └─ NO → Non-Codable components don't sync\n│        struct MyComponent: Component, Codable { ... }\n│\n├─ Does the entity have an owner?\n│   └─ CHECK → Only the owner can modify synced properties\n│        Request ownership before modifying:\n│        entity.requestOwnership { result in ... }\n│\n└─ Is the entity anchored?\n    └─ CHECK → Unanchored entities may not sync position correctly\n         Use a shared world anchor for reliable positioning\n```\n\n---\n\n## Common Mistakes\n\n| Mistake | Time Cost | Fix |\n|---------|-----------|-----|\n| No CollisionComponent on interactive entity | 15-30 min | `entity.generateCollisionShapes(recursive: true)` |\n| Missing InputTargetComponent on visionOS | 10-20 min | Add `InputTargetComponent()` |\n| Gesture on wrong view (not RealityView) | 10-15 min | Attach `.gesture()` to `RealityView` |\n| Entity scale wrong for USD model | 15-30 min | Check units: meters vs centimeters |\n| No lighting in non-AR scene | 10-20 min | Add `DirectionalLightComponent` |\n| Storing entity refs in System | 30-60 min crash debugging | Query with `EntityQuery` each frame |\n| Components not registered | 10-15 min | Call `registerComponent()` in app init |\n| Systems not registered | 10-15 min | Call `registerSystem()` before scene load |\n| Physics across different anchors | 20-40 min | Put interacting entities under same anchor |\n| Calling generateCollisionShapes every frame | Performance degradation | Call once during setup |\n\n---\n\n## Diagnostic Quick Reference\n\n| Symptom | First Check | Time Saved |\n|---------|-------------|------------|\n| Not visible | Has ModelComponent? Scale > 0? | 30-60 min |\n| No gesture response | Has CollisionComponent? | 15-30 min |\n| Not tracking | Anchor type matches environment? | 20-45 min |\n| Frame drops | Entity count? Resource sharing? | 1-3 hours |\n| Wrong colors | Has lighting? Metallic value? | 15-45 min |\n| No collision | Both have CollisionComponent? Same anchor? | 20-40 min |\n| No sync | SynchronizationComponent? Codable? | 30-60 min |\n| Sim OK, device crash | Metal features? Texture format? | 15-30 min |\n\n---\n\n## Symptom 8: Works in Simulator, Crashes on Device\n\n**Time cost**: 15-30 min (often misdiagnosed as model issue)\n\n```\nQ1: Is the crash a Metal error (MTLCommandBuffer, shader compilation)?\n├─ YES → Simulator uses software rendering, device uses real GPU\n│   Common causes:\n│   - Custom Metal shaders with unsupported features\n│   - Texture formats not supported on device GPU\n│   - Exceeding device texture size limits (max 8192x8192 on older)\n│   Fix: Check device GPU family, use supported formats\n│\n└─ NO → Check next\n\nQ2: Is it an out-of-memory crash?\n├─ YES → Simulator has more RAM available\n│   Common: Large USDZ files with uncompressed textures\n│   Fix: Compress textures, reduce polygon count, use LOD\n│   Check: USDZ file size (keep \u003C 50MB for reliable loading)\n│\n└─ NO → Check next\n\nQ3: Is it an AR-related crash (camera, tracking)?\n├─ YES → Simulator has no real camera\u002Fsensors\n│   Fix: Test AR features on device only, use simulator for UI\u002Flayout\n│\n└─ NO → Check device capabilities\n    - A12+ required for RealityKit\n    - LiDAR for scene reconstruction\n    - TrueDepth for face tracking\n```\n\n---\n\n## Resources\n\n**WWDC**: 2019-603, 2019-605, 2023-10080, 2024-10103\n\n**Docs**: \u002Frealitykit, \u002Frealitykit\u002Fentity, \u002Frealitykit\u002Fcollisioncomponent, \u002Frealitykit\u002Fphysicsbodycomponent\n\n**Skills**: axiom-realitykit, axiom-realitykit-ref\n\n","# RealityKit Diagnostics\n\nSystematic diagnosis for common RealityKit issues with time-cost annotations.\n\n## When to Use This Diagnostic Skill\n\nUse this skill when:\n- Entity added but not visible in the scene\n- AR anchor not tracking or content floating\n- Tap\u002Fdrag gestures not responding on 3D entities\n- Frame rate dropping or stuttering\n- Material looks wrong (too dark, too bright, incorrect colors)\n- Multiplayer entities not syncing across devices\n- Physics bodies not colliding or passing through each other\n\nFor RealityKit architecture patterns and best practices, see `axiom-realitykit`. For API reference, see `axiom-realitykit-ref`.\n\n---\n\n## Mandatory First Step: Enable Debug Visualization\n\n**Time cost**: 10 seconds vs hours of blind debugging\n\n```swift\n\u002F\u002F In your RealityView or ARView setup\n#if DEBUG\n\u002F\u002F Xcode: Debug → Attach to Process → Show RealityKit Statistics\n\u002F\u002F Or enable in code:\narView.debugOptions = [\n    .showStatistics,       \u002F\u002F Entity count, draw calls, FPS\n    .showPhysics,          \u002F\u002F Collision shapes\n    .showAnchorOrigins,    \u002F\u002F Anchor positions\n    .showAnchorGeometry    \u002F\u002F Detected plane geometry\n]\n#endif\n```\n\nIf you can't see collision shapes with `.showPhysics`, your `CollisionComponent` is missing or misconfigured. **Fix collision before debugging gestures or physics.**\n\n---\n\n## Symptom 1: Entity Not Visible\n\n**Time saved**: 30-60 min → 2-5 min\n\n```\nEntity added but nothing appears\n│\n├─ Is the entity added to the scene?\n│   └─ NO → Add to RealityView content:\n│        content.add(entity)\n│        ✓ Entities must be in the scene graph to render\n│\n├─ Does the entity have a ModelComponent?\n│   └─ NO → Add mesh and material:\n│        entity.components[ModelComponent.self] = ModelComponent(\n│            mesh: .generateBox(size: 0.1),\n│            materials: [SimpleMaterial(color: .red, isMetallic: false)]\n│        )\n│        ✓ Bare Entity is invisible — it's just a container\n│\n├─ Is the entity's scale zero or nearly zero?\n│   └─ CHECK → Print: entity.scale\n│        USD models may import with unexpected scale.\n│        Try: entity.scale = SIMD3(repeating: 0.01) for meter-scale models\n│\n├─ Is the entity behind the camera?\n│   └─ CHECK → Print: entity.position(relativeTo: nil)\n│        In RealityKit, -Z is forward (toward screen).\n│        Try: entity.position = SIMD3(0, 0, -0.5) (half meter in front)\n│\n├─ Is the entity inside another object?\n│   └─ CHECK → Move to a known visible position:\n│        entity.position = SIMD3(0, 0, -1)\n│\n├─ Is the entity's isEnabled set to false?\n│   └─ CHECK → entity.isEnabled = true\n│        Also check parent: entity.isEnabledInHierarchy\n│\n├─ Is the entity on an untracked anchor?\n│   └─ CHECK → Verify anchor is tracking:\n│        entity.isAnchored (should be true)\n│        If using plane anchor, ensure surface is detected first\n│\n└─ Is the material transparent or OcclusionMaterial?\n    └─ CHECK → Inspect material:\n         If using PhysicallyBasedMaterial, check baseColor is not black\n         If using blending = .transparent, check opacity > 0\n```\n\n### Quick Diagnostic\n\n```swift\nfunc diagnoseVisibility(_ entity: Entity) {\n    print(\"Name: \\(entity.name)\")\n    print(\"Is enabled: \\(entity.isEnabled)\")\n    print(\"In hierarchy: \\(entity.isEnabledInHierarchy)\")\n    print(\"Is anchored: \\(entity.isAnchored)\")\n    print(\"Position (world): \\(entity.position(relativeTo: nil))\")\n    print(\"Scale: \\(entity.scale)\")\n    print(\"Has model: \\(entity.components[ModelComponent.self] != nil)\")\n    print(\"Children: \\(entity.children.count)\")\n}\n```\n\n---\n\n## Symptom 2: Anchor Not Tracking\n\n**Time saved**: 20-45 min → 3-5 min\n\n```\nAR content not appearing or floating\n│\n├─ Is the AR session running?\n│   └─ For RealityView on iOS 18+, AR runs automatically\n│       For ARView, check: arView.session.isRunning\n│\n├─ Is SpatialTrackingSession configured? (iOS 18+)\n│   └─ CHECK → Ensure tracking modes requested:\n│        let config = SpatialTrackingSession.Configuration(\n│            tracking: [.plane, .object])\n│        let result = await session.run(config)\n│        if let notSupported = result {\n│            \u002F\u002F Handle unsupported modes\n│        }\n│\n├─ Is the anchor type appropriate for the environment?\n│   ├─ .plane(.horizontal) → Need a flat surface visible to camera\n│   ├─ .plane(.vertical) → Need a wall visible to camera\n│   ├─ .image → Image must be in \"AR Resources\" asset catalog\n│   ├─ .face → Front camera required (not rear)\n│   └─ .body → Full body must be visible\n│\n├─ Is minimumBounds too large?\n│   └─ CHECK → Reduce minimum bounds:\n│        AnchorEntity(.plane(.horizontal, classification: .any,\n│            minimumBounds: SIMD2(0.1, 0.1)))  \u002F\u002F Smaller = detects sooner\n│\n├─ Is the device supported?\n│   └─ CHECK → Plane detection requires A12+ chip\n│       Face tracking requires TrueDepth camera\n│       Body tracking requires A12+ chip\n│\n└─ Is the environment adequate?\n    └─ CHECK → AR needs:\n         - Adequate lighting (not too dark)\n         - Textured surfaces (not blank walls)\n         - Stable device position during initial detection\n```\n\n---\n\n## Symptom 3: Gesture Not Responding\n\n**Time saved**: 15-30 min → 2-3 min\n\n```\nTap\u002Fdrag on entity does nothing\n│\n├─ Does the entity have a CollisionComponent?\n│   └─ NO → Add collision shapes:\n│        entity.generateCollisionShapes(recursive: true)\n│        \u002F\u002F or manual:\n│        entity.components[CollisionComponent.self] = CollisionComponent(\n│            shapes: [.generateBox(size: SIMD3(0.1, 0.1, 0.1))])\n│        ✓ Collision shapes are REQUIRED for gesture hit testing\n│\n├─ [visionOS] Does the entity have InputTargetComponent?\n│   └─ NO → Add it:\n│        entity.components[InputTargetComponent.self] = InputTargetComponent()\n│        ✓ Required on visionOS for gesture input\n│\n├─ Is the gesture attached to the RealityView?\n│   └─ CHECK → Gesture must be on the view, not the entity:\n│        RealityView { content in ... }\n│            .gesture(TapGesture().targetedToAnyEntity().onEnded { ... })\n│\n├─ Is the collision shape large enough to hit?\n│   └─ CHECK → Enable .showPhysics to see shapes\n│        Shapes too small = hard to tap.\n│        Try: .generateBox(size: SIMD3(repeating: 0.1)) minimum\n│\n├─ Is the entity behind another entity?\n│   └─ CHECK → Front entities may block gestures on back entities\n│        Ensure collision is on the intended target\n│\n└─ Is the entity enabled?\n    └─ CHECK → entity.isEnabled must be true\n         Disabled entities don't receive input\n```\n\n### Quick Diagnostic\n\n```swift\nfunc diagnoseGesture(_ entity: Entity) {\n    print(\"Has collision: \\(entity.components[CollisionComponent.self] != nil)\")\n    print(\"Has input target: \\(entity.components[InputTargetComponent.self] != nil)\")\n    print(\"Is enabled: \\(entity.isEnabled)\")\n    print(\"Is anchored: \\(entity.isAnchored)\")\n\n    if let collision = entity.components[CollisionComponent.self] {\n        print(\"Collision shapes: \\(collision.shapes.count)\")\n    }\n}\n```\n\n---\n\n## Symptom 4: Performance Problems\n\n**Time saved**: 1-3 hours → 10-20 min\n\n```\nFrame rate dropping or stuttering\n│\n├─ How many entities are in the scene?\n│   └─ CHECK → Print entity count:\n│        var count = 0\n│        func countEntities(_ entity: Entity) {\n│            count += 1\n│            for child in entity.children { countEntities(child) }\n│        }\n│        Under 100: unlikely to be entity count\n│        100-500: review for optimization\n│        500+: definitely needs optimization\n│\n├─ Are mesh\u002Fmaterial resources shared?\n│   └─ NO → Share resources across identical entities:\n│        let sharedMesh = MeshResource.generateBox(size: 0.05)\n│        let sharedMaterial = SimpleMaterial(color: .white, isMetallic: false)\n│        \u002F\u002F Reuse for all instances\n│        ✓ RealityKit batches entities with identical resources\n│\n├─ Is a System creating components every frame?\n│   └─ CHECK → Look for allocations in update():\n│        Creating ModelComponent, CollisionComponent, or materials\n│        every frame causes GC pressure.\n│        Cache resources, only update when values change.\n│\n├─ Are collision shapes mesh-based?\n│   └─ CHECK → Replace generateCollisionShapes(recursive: true)\n│        with simple shapes (box, sphere, capsule) for dynamic entities\n│\n├─ Is generateCollisionShapes called repeatedly?\n│   └─ CHECK → Call once during setup, not every frame\n│\n├─ Are there too many physics bodies?\n│   └─ CHECK → Dynamic bodies are most expensive.\n│        Convert distant\u002Fstatic objects to .static mode.\n│        Remove physics from non-interactive entities.\n│\n└─ Is the model polygon count too high?\n    └─ CHECK → Decimate models for real-time use.\n         Target: \u003C100K triangles total for mobile AR.\n         Use LOD (Level of Detail) for distant objects.\n```\n\n---\n\n## Symptom 5: Material Looks Wrong\n\n**Time saved**: 15-45 min → 5-10 min\n\n```\nColors, lighting, or textures look incorrect\n│\n├─ Is the scene too dark?\n│   └─ CHECK → Missing environment lighting:\n│        Add DirectionalLightComponent or EnvironmentResource\n│        In AR, RealityKit uses real-world lighting automatically\n│        In non-AR, you must provide lighting explicitly\n│\n├─ Is the baseColor set?\n│   └─ CHECK → PhysicallyBasedMaterial defaults to white\n│        material.baseColor = .init(tint: .red)\n│        If using a texture, verify it loaded:\n│        try TextureResource(named: \"albedo\")\n│\n├─ Is metallic set incorrectly?\n│   └─ CHECK → metallic = 1.0 makes surfaces mirror-like\n│        Most real objects: metallic = 0.0\n│        Only metals (gold, silver, chrome): metallic = 1.0\n│\n├─ Is the texture semantic wrong?\n│   └─ CHECK → Use correct semantic:\n│        .color for albedo\u002FbaseColor textures\n│        .raw for data textures (metallic, roughness)\n│        .normal for normal maps\n│        .hdrColor for HDR textures\n│\n├─ Is the model upside down or inside out?\n│   └─ CHECK → Try:\n│        material.faceCulling = .none (shows both sides)\n│        If that fixes it, the model normals are flipped\n│\n└─ Is blending\u002Ftransparency unexpected?\n    └─ CHECK → material.blending\n         Default is .opaque\n         For transparency: .transparent(opacity: ...)\n```\n\n---\n\n## Symptom 6: Physics Not Working\n\n**Time saved**: 20-40 min → 5-10 min\n\n```\nObjects pass through each other or don't collide\n│\n├─ Do both entities have CollisionComponent?\n│   └─ NO → Both sides of a collision need CollisionComponent\n│\n├─ Does the moving entity have PhysicsBodyComponent?\n│   └─ NO → Add physics body:\n│        entity.components[PhysicsBodyComponent.self] = PhysicsBodyComponent(\n│            mode: .dynamic)\n│\n├─ Are collision groups\u002Ffilters configured correctly?\n│   └─ CHECK → Entities must be in compatible groups:\n│        Default: group = .default, mask = .all\n│        If using custom groups, verify mask includes the other group\n│\n├─ Is the physics mode correct?\n│   ├─ Two .static bodies → Never collide (both immovable)\n│   ├─ .dynamic + .static → Correct (common setup)\n│   ├─ .dynamic + .dynamic → Both move on collision\n│   └─ .kinematic + .dynamic → Kinematic pushes dynamic\n│\n├─ Is the collision shape appropriate?\n│   └─ CHECK → .showPhysics debug option\n│        Shape may be too small, offset, or wrong type\n│\n└─ Are entities on different anchors?\n    └─ CHECK → \"Physics bodies and colliders affect only\n         entities that share the same anchor\" (Apple docs)\n         Move entities under the same anchor for physics interaction\n```\n\n---\n\n## Symptom 7: Multiplayer Sync Issues\n\n**Time saved**: 30-60 min → 10-15 min\n\n```\nEntities not appearing on other devices\n│\n├─ Does the entity have SynchronizationComponent?\n│   └─ NO → Add it:\n│        entity.components[SynchronizationComponent.self] =\n│            SynchronizationComponent()\n│\n├─ Is the MultipeerConnectivityService set up?\n│   └─ CHECK → Verify MCSession is connected before syncing\n│\n├─ Are custom components Codable?\n│   └─ NO → Non-Codable components don't sync\n│        struct MyComponent: Component, Codable { ... }\n│\n├─ Does the entity have an owner?\n│   └─ CHECK → Only the owner can modify synced properties\n│        Request ownership before modifying:\n│        entity.requestOwnership { result in ... }\n│\n└─ Is the entity anchored?\n    └─ CHECK → Unanchored entities may not sync position correctly\n         Use a shared world anchor for reliable positioning\n```\n\n---\n\n## Common Mistakes\n\n| Mistake | Time Cost | Fix |\n|---------|-----------|-----|\n| No CollisionComponent on interactive entity | 15-30 min | `entity.generateCollisionShapes(recursive: true)` |\n| Missing InputTargetComponent on visionOS | 10-20 min | Add `InputTargetComponent()` |\n| Gesture on wrong view (not RealityView) | 10-15 min | Attach `.gesture()` to `RealityView` |\n| Entity scale wrong for USD model | 15-30 min | Check units: meters vs centimeters |\n| No lighting in non-AR scene | 10-20 min | Add `DirectionalLightComponent` |\n| Storing entity refs in System | 30-60 min crash debugging | Query with `EntityQuery` each frame |\n| Components not registered | 10-15 min | Call `registerComponent()` in app init |\n| Systems not registered | 10-15 min | Call `registerSystem()` before scene load |\n| Physics across different anchors | 20-40 min | Put interacting entities under same anchor |\n| Calling generateCollisionShapes every frame | Performance degradation | Call once during setup |\n\n---\n\n## Diagnostic Quick Reference\n\n| Symptom | First Check | Time Saved |\n|---------|-------------|------------|\n| Not visible | Has ModelComponent? Scale > 0? | 30-60 min |\n| No gesture response | Has CollisionComponent? | 15-30 min |\n| Not tracking | Anchor type matches environment? | 20-45 min |\n| Frame drops | Entity count? Resource sharing? | 1-3 hours |\n| Wrong colors | Has lighting? Metallic value? | 15-45 min |\n| No collision | Both have CollisionComponent? Same anchor? | 20-40 min |\n| No sync | SynchronizationComponent? Codable? | 30-60 min |\n| Sim OK, device crash | Metal features? Texture format? | 15-30 min |\n\n---\n\n## Symptom 8: Works in Simulator, Crashes on Device\n\n**Time cost**: 15-30 min (often misdiagnosed as model issue)\n\n```\nQ1: Is the crash a Metal error (MTLCommandBuffer, shader compilation)?\n├─ YES → Simulator uses software rendering, device uses real GPU\n│   Common causes:\n│   - Custom Metal shaders with unsupported features\n│   - Texture formats not supported on device GPU\n│   - Exceeding device texture size limits (max 8192x8192 on older)\n│   Fix: Check device GPU family, use supported formats\n│\n└─ NO → Check next\n\nQ2: Is it an out-of-memory crash?\n├─ YES → Simulator has more RAM available\n│   Common: Large USDZ files with uncompressed textures\n│   Fix: Compress textures, reduce polygon count, use LOD\n│   Check: USDZ file size (keep \u003C 50MB for reliable loading)\n│\n└─ NO → Check next\n\nQ3: Is it an AR-related crash (camera, tracking)?\n├─ YES → Simulator has no real camera\u002Fsensors\n│   Fix: Test AR features on device only, use simulator for UI\u002Flayout\n│\n└─ NO → Check device capabilities\n    - A12+ required for RealityKit\n    - LiDAR for scene reconstruction\n    - TrueDepth for face tracking\n```\n\n---\n\n## Resources\n\n**WWDC**: 2019-603, 2019-605, 2023-10080, 2024-10103\n\n**Docs**: \u002Frealitykit, \u002Frealitykit\u002Fentity, \u002Frealitykit\u002Fcollisioncomponent, \u002Frealitykit\u002Fphysicsbodycomponent\n\n**Skills**: axiom-realitykit, axiom-realitykit-ref\n\n",{"name":5,"license":15,"metadata":31,"description":7},{"version":32},"1.0.0","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-realitykit-diag",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill axiom-realitykit-diag",{"tool":48,"command":49},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill axiom-realitykit-diag",{"tool":51,"command":52},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill axiom-realitykit-diag","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-realitykit-diag\u002FSKILL.md",true,[],[57,66,75,84,90,96],{"skillNo":58,"name":59,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":26},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[63,64,65],"model","model hierarchy","model hierarchy skill",{"skillNo":67,"name":68,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":26},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[72,73,74],"MCP","zoom","zoom mcp",{"skillNo":76,"name":77,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":26},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[81,82,83,73],"sdk","zoom apps sdk","apps",{"skillNo":85,"name":86,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":26},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[86],{"skillNo":91,"name":92,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":26},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[92],{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":26},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[98]]