jpskill.com
📦 その他 コミュニティ

game-physics

Handles physics simulations in games, including collision detection, rigid body dynamics, and force applications.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o game-physics.zip https://jpskill.com/download/22221.zip && unzip -o game-physics.zip && rm game-physics.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22221.zip -OutFile "$d\game-physics.zip"; Expand-Archive "$d\game-physics.zip" -DestinationPath $d -Force; ri "$d\game-physics.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して game-physics.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → game-physics フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

game-physics

目的

このスキルは、衝突検出、剛体ダイナミクス、力の適用といったコアメカニクスに焦点を当て、ゲームの物理シミュレーションを処理します。ゲームエンジンと統合してリアルなインタラクションをシミュレートし、2D/3D環境で正確な物理挙動を保証します。

使用する場面

プラットフォーマー、シミュレーション、マルチプレイヤーワールドなど、物理演算を必要とするゲームを開発する際にこのスキルを使用してください。オブジェクトのインタラクション(例:ボールの跳ね返り、キャラクターの動き)、パフォーマンスが重要なシミュレーション、またはUnityやGodotのような既存のゲームエンジンを拡張するシナリオに適用します。ゲーム以外のアプリケーションや単純なアニメーションには使用しないでください。

主な機能

  • 衝突検出:AABB、OBB、球体ベースのチェックをサポートし、正確な交差のためにSATなどのアルゴリズムを使用します。
  • 剛体ダイナミクス:速度、加速度、トルクをシミュレートし、力の適用にはニュートンの法則と統合します。
  • 力の処理:インパルス、重力、摩擦を適用し、ベクトル入力(例:[x, y, z]の力)で設定可能です。
  • シミュレーション制御:シミュレーションの一時停止、ステップ実行、リセットを行い、スローモーション効果のために時間スケールを処理します。
  • 最適化:空間分割(例:クアッドツリー)を使用して、大規模なシーンでの計算を削減します。

使用パターン

このスキルは、OpenClawのCLIまたはAPIを介して呼び出し、モジュール式の統合を行います。まずシーン設定をロードし、次にループでシミュレーションを実行します。CLIの場合、ファイルから入力をパイプし、APIの場合、JSONペイロードを使用します。常に環境変数$OPENCLAW_API_KEYで認証を設定してください。使用パターンの例:設定のロード → シミュレーションの初期化 → 更新ループ → 結果の出力。

一般的なコマンド/API

インタラクションには、以下のCLIコマンドまたはAPIエンドポイントを使用してください。すべてのコマンドは$OPENCLAW_API_KEYによる認証が必要です。

  • CLIコマンド: openclaw game-physics simulate --file scene.json --steps 100 --gravity 9.8

    • フラグ: JSON設定用の--file(例:{"objects": [{"mass": 1.0, "position": [0,0,0]}]})、シミュレーション反復回数用の--steps、ベクトル[x,y,z]用の--gravity
    • 例: export OPENCLAW_API_KEY=your_key; openclaw game-physics simulate --file input.jsonで実行します。
  • APIエンドポイント: POST /api/game-physics/simulate

    • ペイロード: {"scene": {"objects": [{"id": "ball", "mass": 2.0, "velocity": [1,0,0]}]}, "steps": 50}のようなJSON。
    • ヘッダー: Authorization: Bearer $OPENCLAW_API_KEYを含めます。
    • レスポンス: {"positions": [{"id": "ball", "newPosition": [5,0,0]}]}のような結果を含むJSON。
  • コードスニペット (Python CLIラッパー):

    import os
    import subprocess
    api_key = os.environ.get('OPENCLAW_API_KEY')
    subprocess.run(['openclaw', 'game-physics', 'simulate', '--file', 'scene.json', '--steps', '10'])
  • コードスニペット (requestsによるAPI呼び出し):

    import requests
    headers = {'Authorization': f'Bearer {os.environ.get("OPENCLAW_API_KEY")}'}
    data = {'scene': {'objects': [{'mass': 1.0, 'position': [0,0,0]}]}, 'steps': 20}
    response = requests.post('https://api.openclaw.ai/api/game-physics/simulate', json=data, headers=headers)

設定形式: シーンにはJSONを使用します。例:{"objects": [{"id": "obj1", "shape": "sphere", "radius": 1.0, "mass": 5.0, "position": [0,0,0]}]}。スキーマで検証します。オブジェクトには"id"、"shape"、および物理プロパティが必要です。

統合に関する注意点

ゲームループにスキルをラップして統合します。ユーザー入力後または一定間隔でsimulateを呼び出します。ゲームエンジンの場合、レンダリングのために結果をベクトルとしてエクスポートします。カスタムコールバックにはフックを使用します。例:CLIの--callback-urlを介して。他のOpenClawスキルと連携する場合、出力をチェーンします(例:シミュレーション結果をレンダリングスキルに渡す)。データ形式を一致させることで互換性を確保します。物理出力は標準配列[x,y,z]です。非同期操作には、Webhook付きのAPIを使用します。

エラー処理

一般的なエラーには、無効な設定(例:「mass」フィールドの欠落)、認証失敗、シミュレーションのオーバーフローなどがあります。これらは以下のように処理します。

  • コマンドの前に$OPENCLAW_API_KEYを確認し、設定されていない場合はエラーとします。
  • jsonschemaのようなライブラリを使用してJSONスキーマを検証します。例:レスポンスステータスが400の場合、「Missing field: mass」のようなエラーメッセージを解析します。
  • コードスニペット (Pythonでのエラー処理):
    try:
        result = subprocess.run(['openclaw', 'game-physics', 'simulate', '--file', 'invalid.json'], check=True)
    except subprocess.CalledProcessError as e:
        print(f"Error: {e.returncode} - {e.stderr.decode()}")
  • APIの場合:HTTPエラー(例:認証問題の401)をキャッチし、指数バックオフで再試行します。CLIの--debugフラグを使用して詳細なエラーをログに記録します。

具体的な使用例

  1. 跳ねるボールのシミュレーション: シンプルな物理デモに使用します。コマンド: openclaw game-physics simulate --file ball.json --steps 50 --gravity [0,-9.8,0]。コードでは、{"objects": [{"id": "ball", "shape": "sphere", "position": [0,10,0], "velocity": [5,0,0], "bounciness": 0.8}]}を含む"ball.json"をロードし、毎フレームゲームの位置を更新するために適用します。

  2. ゲームレベルでの衝突検出: プラットフォーマーでヒットを検出します。API呼び出し: POST /api/game-physics/simulate{"scene": {"objects": [{"id": "player", "position": [1,2,0]}, {"id": "wall", "shape": "box", "position": [0,0,0]}]}, "steps": 1}を送信します。レスポンスを処理して衝突をチェックし、それに応じてプレイヤーの動きを調整します。

グラフの関係

  • クラスターに関連: game-dev(例:レンダリングやAIスキルとデータを共有します)。
  • 接続スキル: rendering(視覚化のために位置を出力します)、pathfinding(動的な環境のために物理演算を使用します)。
  • 依存関係: 認証のためにコアOpenClawサービスを必要とします。ゲーム以外のクラスターへの直接的なエッジはありません。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

game-physics

Purpose

This skill handles physics simulations for games, focusing on core mechanics like collision detection, rigid body dynamics, and force applications. It integrates with game engines to simulate realistic interactions, ensuring accurate physics behavior in 2D/3D environments.

When to Use

Use this skill when developing games that require physics, such as platformers, simulations, or multiplayer worlds. Apply it for scenarios involving object interactions (e.g., ball bouncing, character movement), performance-critical simulations, or when extending existing game engines like Unity or Godot. Avoid it for non-game applications or simple animations.

Key Capabilities

  • Collision detection: Supports AABB, OBB, and sphere-based checks; uses algorithms like SAT for precise intersections.
  • Rigid body dynamics: Simulates velocity, acceleration, and torque; integrates with Newton's laws for force applications.
  • Force handling: Applies impulses, gravity, and friction; configurable via vector inputs (e.g., [x, y, z] forces).
  • Simulation control: Pauses, steps, or resets simulations; handles time scaling for slow-motion effects.
  • Optimization: Uses spatial partitioning (e.g., quadtrees) to reduce computation in large scenes.

Usage Patterns

Invoke this skill via OpenClaw's CLI or API for modular integration. Start by loading a scene configuration, then run simulations in a loop. For CLI, pipe inputs from files; for API, use JSON payloads. Always set up authentication with $OPENCLAW_API_KEY in your environment. Example pattern: Load config → Initialize simulation → Update loop → Output results.

Common Commands/API

Use the following CLI commands or API endpoints for interactions. All commands require authentication via $OPENCLAW_API_KEY.

  • CLI Command: openclaw game-physics simulate --file scene.json --steps 100 --gravity 9.8

    • Flags: --file for JSON config (e.g., {"objects": [{"mass": 1.0, "position": [0,0,0]}]}), --steps for simulation iterations, --gravity for vector [x,y,z].
    • Example: Run with export OPENCLAW_API_KEY=your_key; openclaw game-physics simulate --file input.json.
  • API Endpoint: POST /api/game-physics/simulate

    • Payload: JSON like {"scene": {"objects": [{"id": "ball", "mass": 2.0, "velocity": [1,0,0]}]}, "steps": 50}
    • Headers: Include Authorization: Bearer $OPENCLAW_API_KEY
    • Response: JSON with results, e.g., {"positions": [{"id": "ball", "newPosition": [5,0,0]}]}
  • Code Snippet (Python CLI wrapper):

    import os
    import subprocess
    api_key = os.environ.get('OPENCLAW_API_KEY')
    subprocess.run(['openclaw', 'game-physics', 'simulate', '--file', 'scene.json', '--steps', '10'])
  • Code Snippet (API call with requests):

    import requests
    headers = {'Authorization': f'Bearer {os.environ.get("OPENCLAW_API_KEY")}'}
    data = {'scene': {'objects': [{'mass': 1.0, 'position': [0,0,0]}]}, 'steps': 20}
    response = requests.post('https://api.openclaw.ai/api/game-physics/simulate', json=data, headers=headers)

Config formats: Use JSON for scenes, e.g., {"objects": [{"id": "obj1", "shape": "sphere", "radius": 1.0, "mass": 5.0, "position": [0,0,0]}]}. Validate with schema: objects must have "id", "shape", and physics properties.

Integration Notes

Integrate by wrapping the skill in your game loop: Call simulate after user inputs or at fixed intervals. For game engines, export results as vectors for rendering. Use hooks for custom callbacks, e.g., via --callback-url in CLI. If using with other OpenClaw skills, chain outputs (e.g., pass simulation results to a rendering skill). Ensure compatibility by matching data formats; physics outputs are in standard arrays [x,y,z]. For async operations, use API with webhooks.

Error Handling

Common errors include invalid configs (e.g., missing "mass" field), authentication failures, or simulation overflows. Handle with:

  • Check $OPENCLAW_API_KEY before commands; error if unset.
  • Validate JSON schemas using a library like jsonschema; example: If response status is 400, parse error message like "Missing field: mass".
  • Code Snippet (Error handling in Python):
    try:
        result = subprocess.run(['openclaw', 'game-physics', 'simulate', '--file', 'invalid.json'], check=True)
    except subprocess.CalledProcessError as e:
        print(f"Error: {e.returncode} - {e.stderr.decode()}")
  • For API: Catch HTTP errors (e.g., 401 for auth issues) and retry with exponential backoff. Log detailed errors with --debug flag in CLI.

Concrete Usage Examples

  1. Simulate a bouncing ball: Use for a simple physics demo. Command: openclaw game-physics simulate --file ball.json --steps 50 --gravity [0,-9.8,0]. In code: Load "ball.json" with {"objects": [{"id": "ball", "shape": "sphere", "position": [0,10,0], "velocity": [5,0,0], "bounciness": 0.8}]}, then apply to update game positions every frame.

  2. Collision detection in a game level: For a platformer, detect hits. API call: POST /api/game-physics/simulate with {"scene": {"objects": [{"id": "player", "position": [1,2,0]}, {"id": "wall", "shape": "box", "position": [0,0,0]}]}, "steps": 1}. Process response to check for collisions and adjust player movement accordingly.

Graph Relationships

  • Related to cluster: game-dev (e.g., shares data with rendering or AI skills).
  • Connected skills: rendering (outputs positions for visualization), pathfinding (uses physics for dynamic environments).
  • Dependencies: Requires core OpenClaw services for authentication; no direct edges to non-game clusters.