<Body> component lets you add physical bodies (boxes, spheres, cylinders) to the simulation as JSX. Bodies are injected into the MJCF XML before model compilation, so they participate fully in physics — collisions, gravity, grasping, etc.
Usage
How it works
<Body> registers its definition in a provider-level registry. Bodies present at initial mount are included in the first loadScene() call with zero extra reloads. Bodies added or removed after the initial load trigger a debounced scene reload.
When children are provided, the SceneRenderer skips default geom visuals for that body, and the <Body> component syncs a <group> wrapper to the body’s physics pose each frame instead.
Props
Unique body name. Used as the MuJoCo body name in the XML.
Geom type for the body.
Geom size. Interpretation depends on type — see MuJoCo geom size docs.
Initial world position of the body.
Color and alpha for the default geom visual. Ignored when children are provided.
Body mass in kg.
Whether to add a freejoint so the body can move freely.
MuJoCo friction parameters, e.g.
"1.5 0.3 0.1".MuJoCo solver reference parameters.
MuJoCo solver impedance parameters.
Contact dimensionality. Use
4 or 6 for grasping.Optional custom Three.js visuals. When provided, default geom rendering is skipped and the children are synced to the body’s physics pose.