Skip to content

AAMjManager

Thin coordinator actor for the MuJoCo simulation within Unreal Engine.

Owns subsystem components and delegates to them: - UMjPhysicsEngine: simulation lifecycle, model/data, options, async loop - UMjDebugVisualizer: debug drawing, collision wireframes - UMjNetworkManager: ZMQ components, camera streaming - UMjInputHandler: keyboard hotkeys External code accesses subsystem state via Manager->PhysicsEngine->X, etc.

Attribute Value
Kind Class
UE Macro UCLASS
Inherits AActor

Properties

Public Properties

Property Type Description
PhysicsEngine UMjPhysicsEngine* Core physics engine component that owns the MuJoCo simulation lifecycle.
DebugVisualizer UMjDebugVisualizer* Debug visualization component for contact forces, collision wireframes, etc.
NetworkManager UMjNetworkManager* Network component managing ZMQ discovery and camera streaming.
InputHandler UMjInputHandler* Input handler component for keyboard hotkeys.
Instance static AAMjManager* Singleton instance pointer. Set in BeginPlay, cleared in EndPlay.
bAutoCreateSimulateWidget bool If true, automatically creates and adds the MjSimulate dashboard widget to the viewport on BeginPlay.
SimulateWidget UUserWidget* Reference to the auto-created simulate widget (if any).
m_MujocoComponents TArray<UMjQuickConvertComponent*> List of custom physics components registered with this manager.
m_articulations TArray<AMjArticulation*> List of articulations (multi-body structures) registered with this manager.
m_heightfieldActors TArray<AMjHeightfieldActor*> List of heightfield actors registered with this manager.

PhysicsEngine

Core physics engine component that owns the MuJoCo simulation lifecycle.

  • Type: UMjPhysicsEngine*
  • Editor: 👁 VisibleAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: MuJoCo

DebugVisualizer

Debug visualization component for contact forces, collision wireframes, etc.

  • Type: UMjDebugVisualizer*
  • Editor: 👁 VisibleAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: MuJoCo

NetworkManager

Network component managing ZMQ discovery and camera streaming.

  • Type: UMjNetworkManager*
  • Editor: 👁 VisibleAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: MuJoCo

InputHandler

Input handler component for keyboard hotkeys.

  • Type: UMjInputHandler*
  • Editor: 👁 VisibleAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: MuJoCo

Instance

Singleton instance pointer. Set in BeginPlay, cleared in EndPlay.

bAutoCreateSimulateWidget

If true, automatically creates and adds the MjSimulate dashboard widget to the viewport on BeginPlay.

  • Type: bool
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|UI

SimulateWidget

Reference to the auto-created simulate widget (if any).

  • Type: UUserWidget*

m_MujocoComponents

List of custom physics components registered with this manager.

  • Type: TArray<UMjQuickConvertComponent*>
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: Mujoco Physics|Objects

m_articulations

List of articulations (multi-body structures) registered with this manager.

  • Type: TArray<AMjArticulation*>
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: Mujoco Physics|Objects

m_heightfieldActors

List of heightfield actors registered with this manager.

  • Type: TArray<AMjHeightfieldActor*>
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🟢 ReadOnly
  • Category: Mujoco Physics|Objects

Protected Properties

Property Type Description
m_ArticulationMap TMapAMjArticulation\*> O(1) articulation lookup built in PostCompile(). Key = actor name.

m_ArticulationMap

O(1) articulation lookup built in PostCompile(). Key = actor name.

  • Type: TMapAMjArticulation\*>

Functions

Public Functions

General

Function Returns Description
AAMjManager() Default constructor.
Tick() void Called every frame.
Compile() void Compiles the aggregated mjSpec into an mjModel and initializes mjData.
PreCompile() void Scans the scene for Mujoco components and Articulations to populate m_spec.
PostCompile() void Finalizes setup after compilation, such as initializing actuator maps.
AAMjManager

Default constructor.

  • Signature: AAMjManager()
Tick

Called every frame.

  • Signature: Tick(float DeltaTime)
Compile

Compiles the aggregated mjSpec into an mjModel and initializes mjData.

  • Signature: Compile()
PreCompile

Scans the scene for Mujoco components and Articulations to populate m_spec.

  • Signature: PreCompile()
PostCompile

Finalizes setup after compilation, such as initializing actuator maps.

  • Signature: PostCompile()

MuJoCo|Control

Function Returns Description
SetPaused() void Pauses or Resumes the physics simulation.
ResetSimulation() void Resets the MuJoCo simulation data (qpos, qvel, time) to initial keyframe (or zero).
StepSync() void Pauses the async loop, steps N times synchronously, then restores pause state.
CompileModel() bool Re-runs Compile() and restarts the async simulation loop.
SetPaused

Pauses or Resumes the physics simulation.

  • Signature: SetPaused(bool bPaused)
  • Blueprint: 🔵 Callable
ResetSimulation

Resets the MuJoCo simulation data (qpos, qvel, time) to initial keyframe (or zero).

  • Signature: ResetSimulation()
  • Blueprint: 🔵 Callable 🔧 CallInEditor
StepSync

Pauses the async loop, steps N times synchronously, then restores pause state.

  • Signature: StepSync(int32 NumSteps)
  • Blueprint: 🔵 Callable
CompileModel

Re-runs Compile() and restarts the async simulation loop.

  • Signature: CompileModel()
  • Blueprint: 🔵 Callable
  • Returns: bool

MuJoCo|Global

Function Returns Description
GetManager() AAMjManager* Gets the active MuJoCo Manager instance.
GetArticulation() AMjArticulation* Gets a registered articulation by its Actor name. Returns nullptr if not found.
GetAllArticulations() TArray<AMjArticulation*> Gets all registered articulations.
GetAllQuickComponents() TArray<UMjQuickConvertComponent*> Gets all registered QuickConvert components.
GetAllHeightfields() TArray<AMjHeightfieldActor*> Gets all registered Heightfield actors.
GetManager

Gets the active MuJoCo Manager instance.

  • Signature: GetManager()
  • Blueprint: 💎 Pure
  • Returns: AAMjManager*
GetArticulation

Gets a registered articulation by its Actor name. Returns nullptr if not found.

  • Signature: GetArticulation(const FString& ActorName)
  • Blueprint: 🔵 Callable
  • Returns: AMjArticulation*
GetAllArticulations

Gets all registered articulations.

  • Signature: GetAllArticulations()
  • Blueprint: 🔵 Callable 💎 Pure
  • Returns: TArray<AMjArticulation*>
GetAllQuickComponents

Gets all registered QuickConvert components.

GetAllHeightfields

Gets all registered Heightfield actors.

  • Signature: GetAllHeightfields()
  • Blueprint: 🔵 Callable 💎 Pure
  • Returns: TArray<AMjHeightfieldActor*>

MuJoCo|Snapshot

Function Returns Description
CaptureSnapshot() UMjSimulationState* Captures a full state snapshot of the current simulation.
RestoreSnapshot() void Schedules a simulation state restore for the next physics step.
CaptureSnapshot

Captures a full state snapshot of the current simulation.

RestoreSnapshot

Schedules a simulation state restore for the next physics step.

MuJoCo|Status

Function Returns Description
IsRunning() bool Checks if the simulation is currently running (initialized and not paused).
IsInitialized() bool Checks if the MuJoCo model is compiled and data is allocated.
GetSimTime() float Gets the current MuJoCo simulation time (m_data->time) in seconds.
GetTimestep() float Gets the simulation timestep from Options (dt).
GetLastCompileError() FString Returns the error string from the most recent failed compile, or empty if last compile succeeded.
IsRunning

Checks if the simulation is currently running (initialized and not paused).

  • Signature: IsRunning()
  • Blueprint: 💎 Pure
  • Returns: bool
IsInitialized

Checks if the MuJoCo model is compiled and data is allocated.

  • Signature: IsInitialized()
  • Blueprint: 💎 Pure
  • Returns: bool
GetSimTime

Gets the current MuJoCo simulation time (m_data->time) in seconds.

  • Signature: GetSimTime()
  • Blueprint: 💎 Pure
  • Returns: float
GetTimestep

Gets the simulation timestep from Options (dt).

  • Signature: GetTimestep()
  • Blueprint: 💎 Pure
  • Returns: float
GetLastCompileError

Returns the error string from the most recent failed compile, or empty if last compile succeeded.

  • Signature: GetLastCompileError()
  • Blueprint: 🔵 Callable 💎 Pure
  • Returns: FString

MuJoCo|UI

Function Returns Description
ToggleSimulateWidget() void Toggles visibility of the MjSimulate dashboard widget. Bound to Tab key.
ToggleSimulateWidget

Toggles visibility of the MjSimulate dashboard widget. Bound to Tab key.

  • Signature: ToggleSimulateWidget()
  • Blueprint: 🔵 Callable

Protected Functions

General

Function Returns Description
BeginPlay() void Called when the game starts or when spawned.
EndPlay() void Called when the game ends or the actor is destroyed.
BeginPlay

Called when the game starts or when spawned.

  • Signature: BeginPlay()
EndPlay

Called when the game ends or the actor is destroyed.

  • Signature: EndPlay(const EEndPlayReason::Type EndPlayReason)