Factory Simulation & Physics
Add rigid body physics to scene objects for factory simulation, product testing, and interactive demos.
Status: partially built. The generic Phase 15 factory-simulation vertical (arbitrary per-object rigid bodies) is planned — its earlier
PhysicsWorld/usePhysicsStorestub was removed in the 2026-07 cleanup. Real Rapier physics is live for imported catalog / YGM models viautils/physicsWorld.ts+urdfToPhysics.ts, driven byuseYgmPhysicsStore.
Extending Physics to the Factory-Sim Vertical
Rapier is already a dependency and powers catalog-model physics. Extending it to a general factory-simulation vertical for arbitrary primitives is the planned work. The original stub approach looked like this (illustrative — usePhysicsStore and this PhysicsWorld stub no longer exist):
import { Physics } from '@react-three/rapier'
export function PhysicsWorld({ children }) {
const running = /* planned per-object sim flag */ false
return <Physics paused={!running}>{children}</Physics>
}
Physics Bodies
Each scene object can have an associated PhysicsBody:
| Field | Type | Description |
|---|---|---|
objectId | string | Linked scene object |
type | static / dynamic / kinematic | Physics behavior |
mass | number | Mass in kg (dynamic only) |
friction | number | Surface friction coefficient |
restitution | number | Bounciness (0 = clay, 1 = rubber) |
Planned Store Actions
| Action | Effect |
|---|---|
addBody(objectId, config) | Register a physics body |
removeBody(objectId) | Remove physics simulation |
startSimulation() | Unpause physics engine |
stopSimulation() | Pause physics |
stepSimulation() | Advance one physics tick |