Cannon-es world · 120Hz substeps · gravity & materials
{
setPhysicsEnabled(v)
if (!v) setPhysicsConnected(false) // disconnect when world turns off
}} />
{physicsEnabled && (
v.toFixed(2)} unit=" m/s²" />
{[['🌍 Earth',-9.82],['🌙 Moon',-1.62],['♂ Mars',-3.72],['🪐 Jupiter',-24.8],['🚀 Zero G',0],['🔄 Reverse',9.82]]
.map(([lbl,g])=>(
))}
)}
{/* ── STEP 2: Connect physics to models ── */}
Step 2Connect to Models
{physicsConnected
? '🟢 Physics bodies active — models are under physics control'
: '⚠️ Configure model body types below, then click Connect'}
{physicsEnabled && !physicsConnected && (
💡 Before connecting:
• Set city / ground / buildings → Static
• Set cars / objects → Dynamic
• Adjust mass, friction, etc. per model
• Connecting moves bodies to current model positions
)}
{!physicsConnected ? (
) : (
)}
{physicsConnected && (
{models.length} bod{models.length !== 1 ? 'ies' : 'y'} active ·
Disconnect to reposition models normally
)}
{physicsEnabled && physicsConnected !== undefined && <>
{/* Global material */}
setPhysicsConfig({globalFriction:v})} />
setPhysicsConfig({globalRestitution:v})} />
💡 Traffic simulation tips:
• Set road/buildings to Static, vehicles to Dynamic
• Use Car preset for realistic vehicle mass + COM
• Use Constant Force to simulate engine power
• Use Set Velocity for scripted traffic movement
• Enable CCD on fast-moving vehicles to prevent tunneling
• Lower Center of Mass prevents cars from rolling over