Skip to main content
Register a callback that runs after mj_step every physics frame. Use this for reading simulation results, computing rewards, or logging.

Signature

Usage

Reading State

Computing Rewards (RL)

Logging Sensor Data

Execution Order

Notes

  • After-step runs at physics rate, not render rate
  • Results are available immediately for rendering in the same frame
  • Multiple after-step hooks compose — all run each frame
  • Write results to refs (not React state) to avoid re-renders at 60fps