Skip to main content

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 / usePhysicsStore stub was removed in the 2026-07 cleanup. Real Rapier physics is live for imported catalog / YGM models via utils/physicsWorld.ts + urdfToPhysics.ts, driven by useYgmPhysicsStore.

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:

FieldTypeDescription
objectIdstringLinked scene object
typestatic / dynamic / kinematicPhysics behavior
massnumberMass in kg (dynamic only)
frictionnumberSurface friction coefficient
restitutionnumberBounciness (0 = clay, 1 = rubber)

Planned Store Actions

ActionEffect
addBody(objectId, config)Register a physics body
removeBody(objectId)Remove physics simulation
startSimulation()Unpause physics engine
stopSimulation()Pause physics
stepSimulation()Advance one physics tick