52 lines
1.6 KiB
Markdown
52 lines
1.6 KiB
Markdown
# OpenSpec Change: enterprise-gaming-r3f-physics-cascade
|
|
|
|
- **Change ID**: enterprise-gaming-r3f-physics-cascade
|
|
- **Package**: `@suaveplan/r3f-physics-cascade`
|
|
- **Category**: gaming/physics
|
|
- **Target path**: `gaming/physics/r3f-physics-cascade`
|
|
- **Status**: PROPOSED
|
|
- **Date**: 2026-04-24
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
Deliver `@suaveplan/r3f-physics-cascade` on the genesis branch from scratch at enterprise quality. The package provides cascading physics effects for React Three Fiber: chain-reaction impulse propagation (impact → impulse list → rigid bodies receive forces), structural collapse simulation (rigid-body sleep/wake thresholds), and `CascadeZone` spatial boundaries that limit propagation extent. Wires to `@suaveplan/r3f-physics-rapier` via the core `PhysicsBackend` interface. Genesis adds structured errors, OTel cascade-event counter, and 100% coverage.
|
|
|
|
---
|
|
|
|
## Available workspace deps
|
|
|
|
`@suaveplan/error`, `@suaveplan/types`, `@suaveplan/events`, `@suaveplan/r3f-physics-core`, react, `@react-three/fiber`, three.
|
|
|
|
---
|
|
|
|
## Public API surface
|
|
|
|
```ts
|
|
function CascadeZone(props: CascadeZoneProps): JSX.Element
|
|
// center, radius, maxPropagations
|
|
|
|
function useCascade(): CascadeController
|
|
// trigger(origin, force, radius): void
|
|
```
|
|
|
|
---
|
|
|
|
## File layout
|
|
|
|
```text
|
|
gaming/physics/r3f-physics-cascade/
|
|
package.json / tsconfig.json / vitest.config.ts
|
|
src/
|
|
index.ts / error-codes.ts
|
|
types/common.ts + md
|
|
core/
|
|
cascade-propagator/ (ts + md + types + test + index)
|
|
context/cascade-provider.tsx + md + test
|
|
hooks/use-cascade.ts + md + test
|
|
components/
|
|
CascadeZone/ (tsx + md + test + stories + index)
|
|
tests/integration.test.ts
|
|
```
|