SceneConfig
Every simulation starts with aSceneConfig object that tells mujoco-react what to load and how to configure it:
Required Fields
| Field | Type | Description |
|---|---|---|
src | string | Base URL for model files (e.g. 'https://raw.githubusercontent.com/google-deepmind/mujoco_menagerie/main/franka_emika_panda/') |
sceneFile | string | Entry MJCF file to load (e.g. 'scene.xml') |
Optional Fields
| Field | Type | Default | Description |
|---|---|---|---|
numArmJoints | number | 7 | Number of arm joints for IK |
tcpSiteName | string | 'tcp' | MuJoCo site name for IK target |
gripperActuatorName | string | 'gripper' | Actuator name for gripper control |
homeJoints | number[] | — | Joint positions applied on reset |
sceneObjects | SceneObject[] | — | Dynamic objects injected into scene |
xmlPatches | XmlPatch[] | — | XML transformations before compilation |
onReset | (model, data) => void | — | Custom logic run after each reset |
Model Sources
DeepMind Menagerie
Models from MuJoCo Menagerie can be loaded by pointingsrc at the raw GitHub URL for the model directory:
franka_emika_panda, universal_robots_ur5e, kuka_iiwa_14, robotiq_2f85, and many more.
Custom Server
Pointsrc to any HTTP server hosting MJCF files:
GitHub Repositories
Use raw GitHub URLs for models hosted in your own repos:Scene Objects
Inject dynamic objects (boxes, spheres, cylinders) into the scene without modifying MJCF files:SceneObject Fields
| Field | Type | Default | Description |
|---|---|---|---|
name | string | required | Unique body/geom name |
type | 'box' | 'sphere' | 'cylinder' | required | Geom type |
size | [number, number, number] | required | Geom size (MuJoCo semantics) |
position | [number, number, number] | required | Initial world position |
rgba | [number, number, number, number] | required | Color (0-1 range) |
mass | number | — | Body mass in kg |
freejoint | boolean | — | Add a free joint (6-DOF) |
friction | string | — | MuJoCo friction spec |
solref | string | — | MuJoCo solver reference |
solimp | string | — | MuJoCo solver impedance |
condim | number | — | Contact dimensionality |
</worldbody> before the model is compiled.
XML Patching
For more advanced model customization, usexmlPatches to transform the MJCF XML before it reaches MuJoCo:
XmlPatch Fields
| Field | Type | Description |
|---|---|---|
target | string | Filename to patch |
replace | [string, string] | [search, replacement] string substitution |
inject | string | XML string to inject |
injectAfter | string | Insert inject after this string |