UMjDebugVisualizer¶
Handles debug visualization for the MuJoCo simulation (contact forces, collision wireframes, etc.).
| Attribute | Value |
|---|---|
| Kind | Class |
| UE Macro | UCLASS |
| Inherits | UActorComponent |
| Blueprint Spawnable | ✅ Yes |
Properties¶
Public Properties¶
| Property | Type | Description |
|---|---|---|
bShowDebug |
bool |
If true, draws contact force visualization. |
DebugForceScale |
float |
Scaling factor for contact force visualization. |
DebugMaxForce |
float |
Maximum force value for clamping visual size. |
DebugContactPointSize |
float |
Size of the drawn contact point. |
DebugContactArrowThickness |
float |
Base thickness of the contact force arrow. |
bGlobalDrawDebugCollision |
bool |
Toggles debug collision drawing globally for all articulations. |
bGlobalDrawDebugJoints |
bool |
Toggles debug joint axis/range drawing globally for all articulations. |
bGlobalShowGroup3 |
bool |
Toggles debug Group 3 drawing globally for all articulations. |
bGlobalQuickConvertCollision |
bool |
Toggles debug collision drawing globally for all QuickConvert components. |
DebugShaderMode |
EMjDebugShaderMode | Per-body overlay shader mode (Island / Segmentation / Off). Cycled via key 6. |
bModulateBySleep |
bool |
When true, sleeping bodies are dimmed + desaturated on top of the active shader mode. |
SleepValueScale |
float |
Value (brightness) multiplier applied to sleeping bodies. MuJoCo upstream uses 0.6; default 0.35 dims clearly while keeping hue visible. |
SleepSaturationScale |
float |
Saturation multiplier applied to sleeping bodies. Keep high to preserve hue identity; lower toward 0 to desaturate sleeping bodies to grey. |
bGlobalDrawTendons |
bool |
Toggles smooth-tube tendon/muscle rendering. Toggled via key 7. |
TendonTubeRadius |
float |
Tube radius (cm). Muscle activation scales this up to ~2x per-tendon. |
TendonArcSubdivisions |
int32 |
When a tendon wraps around a cylinder/sphere geom, insert this many intermediate points along the wrap arc. |
OverlayParentMaterial |
UMaterialInterface* |
Parent material for body/tendon overlay MIDs, probed from engine content at BeginPlay. |
OverlayColorParam |
FName |
Vector parameter name on OverlayParentMaterial that accepts the overlay colour. |
bShowDebug¶
If true, draws contact force visualization.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
DebugForceScale¶
Scaling factor for contact force visualization.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
DebugMaxForce¶
Maximum force value for clamping visual size.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
DebugContactPointSize¶
Size of the drawn contact point.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
DebugContactArrowThickness¶
Base thickness of the contact force arrow.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bGlobalDrawDebugCollision¶
Toggles debug collision drawing globally for all articulations.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bGlobalDrawDebugJoints¶
Toggles debug joint axis/range drawing globally for all articulations.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bGlobalShowGroup3¶
Toggles debug Group 3 drawing globally for all articulations.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bGlobalQuickConvertCollision¶
Toggles debug collision drawing globally for all QuickConvert components.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
DebugShaderMode¶
Per-body overlay shader mode (Island / Segmentation / Off). Cycled via key 6.
- Type: EMjDebugShaderMode
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bModulateBySleep¶
When true, sleeping bodies are dimmed + desaturated on top of the active shader mode.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
SleepValueScale¶
Value (brightness) multiplier applied to sleeping bodies. MuJoCo upstream uses 0.6; default 0.35 dims clearly while keeping hue visible.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
SleepSaturationScale¶
Saturation multiplier applied to sleeping bodies. Keep high to preserve hue identity; lower toward 0 to desaturate sleeping bodies to grey.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bGlobalDrawTendons¶
Toggles smooth-tube tendon/muscle rendering. Toggled via key 7.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
TendonTubeRadius¶
Tube radius (cm). Muscle activation scales this up to ~2x per-tendon.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
TendonArcSubdivisions¶
When a tendon wraps around a cylinder/sphere geom, insert this many intermediate points along the wrap arc.
- Type: int32
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
OverlayParentMaterial¶
Parent material for body/tendon overlay MIDs, probed from engine content at BeginPlay.
- Type: UMaterialInterface*
OverlayColorParam¶
Vector parameter name on OverlayParentMaterial that accepts the overlay colour.
- Type: FName
Private Properties¶
| Property | Type | Description |
|---|---|---|
InstanceSegSiblings |
TArray<TObjectPtr<UStaticMeshComponent>> |
Sibling-mesh pool for InstanceSegmentation-mode cameras. Empty when no subscribers. |
SemanticSegSiblings |
TArray<TObjectPtr<UStaticMeshComponent>> |
Sibling-mesh pool for SemanticSegmentation-mode cameras. |
OriginalMaterials |
TMap<TWeakObjectPtr<class UStaticMeshComponent>, class UMaterialInterface*> |
Original slot-0 material on meshes we've overridden, so we can restore. Keyed by mesh component. |
OriginalSlotMaterials |
TMap<TWeakObjectPtr<class UStaticMeshComponent>, TMap<int32, class UMaterialInterface*>> |
Original slot-1..N materials for multi-material meshes. Parallel to OriginalMaterials. |
ActiveMIDs |
TMap<TWeakObjectPtr<class UStaticMeshComponent>, class UMaterialInstanceDynamic*> |
Dynamic material instances we created per mesh, reused across ticks. |
TendonSegmentPool |
TArray<class USplineMeshComponent*> |
Pool of spline-mesh components used by the tube tendon render style. Grown on demand. |
TendonSegmentMIDs |
TArray<class UMaterialInstanceDynamic*> |
One MID per pool entry so each tube can colour independently. Grown in lockstep with TendonSegmentPool. |
TendonTubeMesh |
class UStaticMesh* |
Base cylinder mesh used for every tendon segment. Loaded from /Engine/BasicShapes at BeginPlay. |
InstanceSegSiblings¶
Sibling-mesh pool for InstanceSegmentation-mode cameras. Empty when no subscribers.
- Type: TArray
>
OriginalMaterials¶
Original slot-0 material on meshes we've overridden, so we can restore. Keyed by mesh component.
- Type: TMap
, class UMaterialInterface*>
OriginalSlotMaterials¶
Original slot-1..N materials for multi-material meshes. Parallel to OriginalMaterials.
- Type: TMap
, TMap\ >
ActiveMIDs¶
Dynamic material instances we created per mesh, reused across ticks.
- Type: TMap
, class UMaterialInstanceDynamic*>
TendonSegmentPool¶
Pool of spline-mesh components used by the tube tendon render style. Grown on demand.
- Type: TArray
TendonSegmentMIDs¶
One MID per pool entry so each tube can colour independently. Grown in lockstep with TendonSegmentPool.
- Type: TArray
TendonTubeMesh¶
Base cylinder mesh used for every tendon segment. Loaded from /Engine/BasicShapes at BeginPlay.
- Type: class UStaticMesh*
Functions¶
Public Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
CaptureDebugData() |
void | Captures debug info from m_data to DebugData. Called on Physics Thread. |
UpdateAllGlobalVisibility() |
void | Applies global debug visibility settings to all active articulations. |
ToggleDebugContacts() |
void | Toggle contact force visualization (key: 1). |
ToggleArticulationCollisions() |
void | Toggle collision wireframes on articulations (key: 3). |
ToggleQuickConvertCollisions() |
void | Toggle collision wireframes on Quick Convert objects (key: 5). |
ToggleDebugJoints() |
void | Toggle joint axes on all articulations (key: 4). |
ToggleVisuals() |
void | Toggle visual mesh visibility on all articulations (key: 2). |
CycleDebugShaderMode() |
void | Cycle per-body shader overlay: Off -> Island -> Segmentation -> Off (key: 6). |
ToggleTendons() |
void | Toggle tendon/muscle spline rendering (key: 7). |
InitializeOverlayMaterial() |
void | Loads /Engine/BasicShapes/BasicShapeMaterial and records the first vector param name. |
UpdateBodyOverlays() |
void | Apply per-body overlay MIDs based on DebugShaderMode, or restore originals if Off. |
ClearBodyOverlays() |
void | Restore original materials recorded at overlay apply time, clear caches. |
UpdateTendonTubes() |
void | Rebuild / reuse the spline-mesh tendon segment pool based on the latest snapshot. |
HideTendonTubes() |
void | Hide the tendon tube pool without destroying it. |
ClearTendonTubes() |
void | Destroy the tube pool entirely. Used on EndPlay. |
AcquireSegPool() |
void | Subscribe a camera to the sibling-mesh pool for Mode. |
ReleaseSegPool() |
void | Unsubscribe a camera. When the last subscriber leaves, the pool is destroyed. |
GetSegPoolSiblings() |
void | Snapshot of a currently-live sibling pool. Used for tests and for |
CaptureDebugData¶
Captures debug info from m_data to DebugData. Called on Physics Thread.
- Signature:
CaptureDebugData()
UpdateAllGlobalVisibility¶
Applies global debug visibility settings to all active articulations.
- Signature:
UpdateAllGlobalVisibility()
ToggleArticulationCollisions¶
Toggle collision wireframes on articulations (key: 3).
- Signature:
ToggleArticulationCollisions()
ToggleQuickConvertCollisions¶
Toggle collision wireframes on Quick Convert objects (key: 5).
- Signature:
ToggleQuickConvertCollisions()
ToggleVisuals¶
Toggle visual mesh visibility on all articulations (key: 2).
- Signature:
ToggleVisuals()
CycleDebugShaderMode¶
Cycle per-body shader overlay: Off -> Island -> Segmentation -> Off (key: 6).
- Signature:
CycleDebugShaderMode()
InitializeOverlayMaterial¶
Loads /Engine/BasicShapes/BasicShapeMaterial and records the first vector param name.
- Signature:
InitializeOverlayMaterial()
UpdateBodyOverlays¶
Apply per-body overlay MIDs based on DebugShaderMode, or restore originals if Off.
- Signature:
UpdateBodyOverlays()
ClearBodyOverlays¶
Restore original materials recorded at overlay apply time, clear caches.
- Signature:
ClearBodyOverlays()
UpdateTendonTubes¶
Rebuild / reuse the spline-mesh tendon segment pool based on the latest snapshot.
- Signature:
UpdateTendonTubes()
AcquireSegPool¶
Subscribe a camera to the sibling-mesh pool for Mode.
- Signature:
AcquireSegPool(EMjCameraMode Mode, UMjCamera* Camera,TArray<UPrimitiveComponent*>&OutSiblings)
ReleaseSegPool¶
Unsubscribe a camera. When the last subscriber leaves, the pool is destroyed.
- Signature:
ReleaseSegPool(EMjCameraMode Mode, UMjCamera* Camera)
GetSegPoolSiblings¶
Snapshot of a currently-live sibling pool. Used for tests and for
- Signature:
GetSegPoolSiblings(EMjCameraMode Mode,TArray<UPrimitiveComponent*>&OutSiblings)
Private Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
GetSegPoolArray() |
TArray<TObjectPtr<UStaticMeshComponent>>* |
Returns a mutable ref to the pool matching Mode, or null for non-seg modes. |
BuildSegPool() |
void | Build the seg pool for Mode by walking the world's articulations + quick-convert. |
DestroySegPool() |
void | Destroy all siblings in Mode's pool and clear it. |
SpawnSegSibling() |
UStaticMeshComponent* |
Spawn one sibling mesh for a given original. Returns the new component (already registered). |
GetSegPoolArray¶
Returns a mutable ref to the pool matching Mode, or null for non-seg modes.
- Signature:
GetSegPoolArray(EMjCameraMode Mode) - Returns: TArray
>*
BuildSegPool¶
Build the seg pool for Mode by walking the world's articulations + quick-convert.
- Signature:
BuildSegPool(EMjCameraMode Mode)
DestroySegPool¶
Destroy all siblings in Mode's pool and clear it.
- Signature:
DestroySegPool(EMjCameraMode Mode)
SpawnSegSibling¶
Spawn one sibling mesh for a given original. Returns the new component (already registered).
- Signature:
SpawnSegSibling(UStaticMeshComponent*Original,int32BodyId,uint32GroupHash, EMjCameraMode Mode) - Returns: UStaticMeshComponent*