Initial Commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# OpenSpec Change: enterprise-gaming-r3f-physics-rapier
|
||||
|
||||
- **Change ID**: enterprise-gaming-r3f-physics-rapier
|
||||
- **Package**: `@suaveplan/r3f-physics-rapier`
|
||||
- **Category**: gaming/physics
|
||||
- **Target path**: `gaming/physics/r3f-physics-rapier`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/r3f-physics-rapier` on the genesis branch from scratch at enterprise quality. The package provides a Rapier physics engine integration for React Three Fiber, implementing the `PhysicsBackend` interface from `@suaveplan/r3f-physics-core`. It wraps `@dimforge/rapier3d-compat` (WASM); a `RapierPhysicsProvider` initialises the WASM module asynchronously and provides a `RAPIER.World`; `RigidBody`, `Collider`, and `Joint` components wrap the corresponding Rapier APIs; `useRapierContext()` exposes the raw `RAPIER.World` for advanced usage. Genesis adds structured errors, and 100% coverage.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps
|
||||
|
||||
`@suaveplan/error`, `@suaveplan/r3f-physics-core`, react, `@react-three/fiber`, `@dimforge/rapier3d-compat`, three.
|
||||
|
||||
---
|
||||
|
||||
## Public API surface
|
||||
|
||||
```ts
|
||||
function RapierPhysicsProvider(props: RapierProviderProps): JSX.Element
|
||||
function RigidBody(props: RigidBodyProps): JSX.Element
|
||||
function Collider(props: ColliderProps): JSX.Element
|
||||
function useRapierContext(): RapierCon```text
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/physics/r3f-physics-rapier/
|
||||
package.json / tsconfig.json / vitest.config.ts
|
||||
src/
|
||||
index.ts / error-codes.ts
|
||||
types/common.ts + md
|
||||
context/rapier-provider.tsx + md + test
|
||||
hooks/use-rapier-context.ts + md + test
|
||||
components/
|
||||
RigidBody/ (tsx + md + test + stories + index)
|
||||
Collider/ (tsx + md + test + stories + index)
|
||||
tests/integration.test.ts
|
||||
```
|
||||
@@ -0,0 +1,24 @@
|
||||
# Tasks: enterprise-gaming-r3f-physics-rapier
|
||||
|
||||
## 0. Pre-flight (non-negotiable)
|
||||
|
||||
- [ ] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each)
|
||||
- [ ] 0.2 If any worktrees exist under `.claude/worktrees/`, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (`git worktree remove`) before opening a new one — code that has been lost twice on main is the failure mode this guards against.
|
||||
- [ ] 0.3 Confirm the package set in `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json` count. Drift here means a prior change archived without regenerating the manifest.
|
||||
|
||||
## Phase 1 — Scaffold + types
|
||||
|
||||
## Phase 2 — RapierPhysicsProvider
|
||||
|
||||
- [ ] Async WASM init, World creation, step on R3F frame loop
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 3 — `useRapierContext` hook
|
||||
|
||||
## Phase 4 — `RigidBody` + `Collider` components + stories
|
||||
|
||||
## Phase 5 — Pre-publish gate
|
||||
|
||||
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-physics-rapier` green
|
||||
- [ ] 100% coverage
|
||||
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-physics-rapier`
|
||||
Reference in New Issue
Block a user