Files
Game-studio/references/rapier-integration-starter.md
Rocky aaf6656b49 Initial release: game-studio plugin for Claude Code
Repackaged from OpenAI's game-studio Codex plugin (MIT) for Claude Code.

Changes from upstream:
- Added .claude-plugin/plugin.json (Claude Code plugin manifest)
- Removed .codex-plugin/plugin.json (Codex CLI specific)
- Removed skills/*/agents/openai.yaml (Codex CLI specific)
- Added scripts/requirements.txt (Pillow dependency for sprite-pipeline)
- Added Chinese README with installation guide
2026-04-30 13:41:36 +02:00

1.1 KiB

Rapier Integration Starter

Use this as the smallest canonical pattern for adding physics without letting it take over the whole runtime.

Vanilla Three.js

import RAPIER from "@dimforge/rapier3d-compat";

await RAPIER.init();

const world = new RAPIER.World({ x: 0, y: -9.81, z: 0 });
const body = world.createRigidBody(RAPIER.RigidBodyDesc.dynamic().setTranslation(0, 2, 0));
world.createCollider(RAPIER.ColliderDesc.cuboid(0.5, 0.5, 0.5), body);

renderer.setAnimationLoop(() => {
  world.step();
  const p = body.translation();
  mesh.position.set(p.x, p.y, p.z);
  renderer.render(scene, camera);
});

React Three Fiber

import { Physics, RigidBody } from "@react-three/rapier";

<Physics gravity={[0, -9.81, 0]}>
  <RigidBody colliders="cuboid">
    <mesh>
      <boxGeometry args={[1, 1, 1]} />
      <meshStandardMaterial color="#3dd9b8" />
    </mesh>
  </RigidBody>
</Physics>;

Notes

  • Keep physics state synchronized through an explicit bridge.
  • Do not bury gameplay rules inside render or physics callbacks.