Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Google deepmind Mujoco mjv updateScene

From Leeroopedia
Knowledge Sources
Domains Visualization, 3D_Graphics
Last Updated 2026-02-15 06:00 GMT

Overview

Concrete tool for updating the abstract scene from simulation state provided by the MuJoCo visualization API.

Description

The mjv_updateScene function populates an mjvScene with geometries from the current simulation state. It processes all visible bodies, geoms, sites, tendons, and actuators according to the visualization options, applies the camera transform, handles perturbation visualization, and sorts geometries for rendering.

Usage

Call in the render loop between mj_step and mjr_render to update what will be displayed. Use mjCAT_ALL as catmask to include all geometry categories.

Code Reference

Source Location

  • Repository: mujoco
  • File: src/engine/engine_vis_visualize.c
  • Lines: 3373-3380

Signature

void mjv_updateScene(const mjModel* m, mjData* d, const mjvOption* opt,
                     const mjvPerturb* pert, mjvCamera* cam,
                     int catmask, mjvScene* scn);

Import

#include <mujoco/mujoco.h>

I/O Contract

Inputs

Name Type Required Description
m const mjModel* Yes Physics model
d mjData* Yes Current simulation state
opt const mjvOption* Yes Visualization options
pert const mjvPerturb* No User perturbation state (NULL if none)
cam mjvCamera* Yes Camera viewpoint
catmask int Yes Category bitmask (mjCAT_ALL for everything)
scn mjvScene* Yes Scene to populate

Outputs

Name Type Description
scn (modified) mjvScene* Updated with current geometry positions and visual state

Usage Examples

// In render loop
mjv_updateScene(m, d, &opt, NULL, &cam, mjCAT_ALL, &scn);
mjr_render(mjr_maxViewport(&con), &scn, &con);

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment