ref on MujocoCanvas or useMujoco().api inside R3F.
reset()
Reset the simulation to its initial state.homeJoints from the scene config (if set), runs mj_forward, and calls the onReset callback.
setPaused(paused)
Pause or resume the simulation.Whether the simulation should be paused.
togglePause()
Toggle pause state. Returns the new paused state.boolean — the new paused state.
step(n?)
Advance the simulation byn steps while paused.
Number of physics steps to advance.
setSpeed(multiplier)
Set the simulation speed multiplier.Speed multiplier.
1.0 = real-time, 0.5 = half speed, 2.0 = double speed.getTime()
Get the current simulation time in seconds.number — simulation time in seconds.
getTimestep()
Get the current simulation timestep.number — timestep in seconds.