skills/game-dev/game-physics/SKILL.md
Handles physics simulations in games, including collision detection, rigid body dynamics, and force applications.
npx skillsauth add alphaonedev/openclaw-graph game-physicsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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.
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.
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
--file for JSON config (e.g., {"objects": [{"mass": 1.0, "position": [0,0,0]}]}), --steps for simulation iterations, --gravity for vector [x,y,z].export OPENCLAW_API_KEY=your_key; openclaw game-physics simulate --file input.json.API Endpoint: POST /api/game-physics/simulate
Authorization: Bearer $OPENCLAW_API_KEYCode 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.
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.
Common errors include invalid configs (e.g., missing "mass" field), authentication failures, or simulation overflows. Handle with:
$OPENCLAW_API_KEY before commands; error if unset.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()}")
--debug flag in CLI.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.
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.
tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui