mcpField
S
spatial-developer

spatial-developer

github.com/daffy0208開発38171 回インストール44 週間前に更新
リポジトリ

spatial-developer について

spatial-developer は、空間コンピューティング開発者向けのスキルです。WebXR、Vision Pro、3D Web アプリを扱い、インタラクションや空間オーディオの実装例を提供します。

主な機能

  1. 01ブラウザーでの AR/VR 体験の構築
  2. 02Vision Pro の空間 UI 開発
  3. 03Three.js と React Three Fiber のシーン制作
  4. 04視線選択とハンドジェスチャーの実装
  5. 05空間オーディオの追加

活用シーン

  1. 01WebXR プロジェクトのセットアップ
  2. 02ブラウザー向け AR 機能の開発
  3. 03Vision Pro ネイティブアプリの作成
  4. 043D シーンへのジェスチャーや空間音声の追加

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/daffy0208/ai-dev-standards --skill spatial-developer

インストール後、Claude Code で/spatial-developerを入力して読み込まれたか確認します。

同梱ファイルmanifest.yamlREADME.md

詳細

Spatial Developer Skill

AR/VR エクスペリエンス、空間インターフェース、没入型 3D アプリケーションの構築を支援します。

できること

WebXR 開発:

  • ブラウザーでの AR/VR エクスペリエンス
  • ハンドトラッキングとコントローラー
  • 空間アンカー
  • 没入型環境

Vision Pro 開発:

  • visionOS ネイティブアプリ
  • 空間 UI のデザイン
  • Reality Composer との連携
  • SharePlay エクスペリエンス

3D Web:

  • Three.js シーン
  • React Three Fiber
  • 3D インタラクション
  • 空間オーディオ

WebXR の基本

npm install three @react-three/fiber @react-three/drei @react-three/xr
シンプルな VR シーン
// components/VRScene.tsx
'use client'
import { Canvas } from '@react-three/fiber'
import { VRButton, XR, Controllers, Hands } from '@react-three/xr'
import { Box, OrbitControls } from '@react-three/drei'

export function VRScene() {
  return (
    <>
      <VRButton />
      <Canvas>
        <XR>
          <ambientLight intensity={0.5} />
          <pointLight position={[10, 10, 10]} />

          {/* 3D Content */}
          <Box position={[0, 1, -2]} args={[1, 1, 1]}>
            <meshStandardMaterial color="hotpink" />
          </Box>

          {/* VR Controllers */}
          <Controllers />

          {/* Hand Tracking */}
          <Hands />
        </XR>
      </Canvas>
    </>
  )
}

Web での AR(WebXR)

// components/ARScene.tsx
'use client'
import { Canvas } from '@react-three/fiber'
import { ARButton, XR } from '@react-three/xr'
import { useState } from 'react'

export function ARScene() {
  const [hitTest, setHitTest] = useState(null)

  return (
    <>
      <ARButton
        sessionInit={{
          requiredFeatures: ['hit-test'],
          optionalFeatures: ['dom-overlay']
        }}
      />

      <Canvas>
        <XR
          onHitTest={(hitMatrix, hit) => {
            setHitTest(hit)
          }}
        >
          <ambientLight />

          {hitTest && (
            <mesh position={hitTest.position}>
              <sphereGeometry args={[0.1]} />
              <meshStandardMaterial color="blue" />
            </mesh>
          )}
        </XR>
      </Canvas>
    </>
  )
}

Vision Pro の空間 UI

// ContentView.swift
import SwiftUI
import RealityKit

struct ContentView: View {
    var body: some View {
        RealityView { content in
            // Add 3D content
            let model = ModelEntity(
                mesh: .generateSphere(radius: 0.1),
                materials: [SimpleMaterial(color: .blue, isMetallic: false)]
            )

            content.add(model)
        }
        .toolbar {
            ToolbarItem(placement: .bottomOrnament) {
                HStack {
                    Button("Reset") {
                        // Reset scene
                    }

                    Button("Share") {
                        // SharePlay
                    }
                }
            }
        }
    }
}

3D インタラクションのパターン

視線による選択
'use client'
import { useXR } from '@react-three/xr'
import { useFrame } from '@react-three/fiber'
import { useState } from 'react'

export function GazeSelect() {
  const { player } = useXR()
  const [gazing, setGazing] = useState(false)

  useFrame(() => {
    // Raycast from camera
    const direction = player.camera.getWorldDirection(new Vector3())
    // Check intersection with objects
    // If gazing for 2 seconds, select
  })

  return (
    <mesh onPointerEnter={() => setGazing(true)}>
      <boxGeometry />
      <meshStandardMaterial
        color={gazing ? 'green' : 'white'}
      />
    </mesh>
  )
}
ハンドジェスチャーの認識
'use client'
import { useXREvent } from '@react-three/xr'

export function GestureControl() {
  useXREvent('squeeze', (e) => {
    console.log('Pinch gesture detected')
    // Perform action
  })

  useXREvent('select', (e) => {
    console.log('Select gesture')
  })

  return (
    <mesh>
      <sphereGeometry args={[0.05]} />
      <meshStandardMaterial color="red" />
    </mesh>
  )
}

空間オーディオ

'use client'
import { PositionalAudio } from '@react-three/drei'
import { useRef } from 'react'

export function SpatialSound() {
  const sound = useRef()

  return (
    <mesh position={[2, 1, -3]}>
      <sphereGeometry args={[0.2]} />
      <meshStandardMaterial color="yellow" emissive="yellow" />

      <PositionalAudio
        ref={sound}
        url="/sounds/ambient.mp3"
        distance={5}
        loop
        autoplay
      />
    </mesh>
  )
}

活用する場面

最適な用途:

  • AR/VR の Web エクスペリエンスの構築
  • Vision Pro アプリの作成
  • 3D インタラクションの実装
  • 空間 UI のデザイン
  • 没入型ストーリーテリング

支援できること:

  • WebXR プロジェクトのセットアップ
  • AR 機能の構築
  • ハンドトラッキングの実装
  • 空間インターフェースのデザイン
  • 3D パフォーマンスの最適化

作成するもの

🥽 VR Experiences
📱 AR Applications
👋 Hand Tracking
🎧 Spatial Audio
🌐 WebXR Scenes
🍎 Vision Pro Apps

空間コンピューティングの未来を一緒に築きましょう!

コメント