OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add enzed/r3f-skills --skill r3f-physics
Add Rapier rigid bodies, colliders, forces, sensors, and joints to React Three Fiber. Use for collision-driven movement and simulation; use animation guidance for purely visual motion.
npx skills add enzed/r3f-skills --skill r3f-physics
Check installed Fiber, React, and Rapier versions. Rapier 2 targets Fiber 9 / React 19; older projects need their compatible package line. Keep rendering and simulation ownership separate.
Mount beneath Canvas with lighting. Physics loads WASM asynchronously; include Suspense. Cuboid collider arguments are half-extents, unlike BoxGeometry's full dimensions.
setNextKinematicTranslation/Rotation; velocity-kinematic bodies use linear/angular velocity setters.useFrame; the physics world remains authoritative and interpolation can overwrite it.colliders={false} when supplying complete manual colliders, otherwise automatic colliders may be added as well. Collider sizes/transforms must match world scale; use debug rendering to inspect them.addForce calls accumulate. Do not add the same continuous force every render frame without an explicit force-management strategy.useBeforePhysicsStep for input/forces that must align with simulation ticks. If a controller owns all user forces on a body, it can reset and reapply them per tick; coordinate with other force sources before resetting.setTranslation is different from kinematic movement and can bypass expected collision response.timeStep="vary" trades predictability for variable stepping; multiplying values by render delta does not make the physics deterministic.Physics updateLoop="independent" so active bodies can request renders. A sleeping world should not force unnecessary rendering.interactionGroups instead of hand-building masks unless the format is needed.Check resting contact, collider alignment, impulses, sleeping/waking, and different render frame rates. Test sensor enter/exit, fast-body tunneling, and Strict Mode remounts for the paths used.