AMjArticulation¶
Represents a MuJoCo articulation (robot or multibody system).
This actor parses its hierarchy of MuJoCo-related components (MjBody, MjJoint, etc.) and compiles them into the MuJoCo mjSpec. It also handles runtime synchronization between MuJoCo physics and Unreal SceneComponents.
| Attribute | Value |
|---|---|
| Kind | Class |
| UE Macro | UCLASS |
| Inherits | APawn |
Properties¶
Public Properties¶
| Property | Type | Description |
|---|---|---|
bValidateOnBlueprintCompile |
bool |
If true, automatically validates spec when the Blueprint is compiled. |
bShowGroup3 |
bool |
Toggle to show/hide Group 3 visualization (often used for collision meshes). |
bDrawDebugCollision |
bool |
Toggles debug drawing of MuJoCo collision convex hulls for this articulation. |
bDrawDebugJoints |
bool |
Toggles debug drawing of joint axes and range arcs for this articulation. |
bDrawDebugSites |
bool |
Toggles debug drawing of site markers for this articulation. |
PossessCameraDistance |
float |
Spring arm length when possessed (cm). |
PossessCameraPitch |
float |
Camera pitch angle when possessed (degrees, negative = look down). |
PossessCameraLagSpeed |
float |
Camera position lag speed. Lower = smoother, higher = snappier. |
PossessCameraRotationLagSpeed |
float |
Camera rotation lag speed. Lower = smoother. |
PossessCameraOffset |
FVector |
Vertical offset above body center (cm). Reduces vertical bounce from walking/trotting. |
ControlSource |
uint8 |
Determines whether this specific articulation is controlled by ZMQ or UI/Blueprints. |
OnCollision |
FOnMjCollision |
Fires when a collision occurs involving geoms of this articulation. |
bAttachFailed |
bool |
True if mjs_attach failed during Setup. This articulation has no compiled representation. |
MuJoCoXMLFile |
FFilePath |
Optional: Path to an existing MuJoCo XML to import. |
SimOptions |
FMuJoCoOptions | Simulation options for this articulation's child spec. |
DefaultSceneRoot |
class USceneComponent* |
bValidateOnBlueprintCompile¶
If true, automatically validates spec when the Blueprint is compiled.
- Type: bool
- Editor: ✏️ EditAnywhere
- Category: MuJoCo|Validation
bShowGroup3¶
Toggle to show/hide Group 3 visualization (often used for collision meshes).
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Visuals
bDrawDebugCollision¶
Toggles debug drawing of MuJoCo collision convex hulls for this articulation.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bDrawDebugJoints¶
Toggles debug drawing of joint axes and range arcs for this articulation.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
bDrawDebugSites¶
Toggles debug drawing of site markers for this articulation.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Debug
PossessCameraDistance¶
Spring arm length when possessed (cm).
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Camera
PossessCameraPitch¶
Camera pitch angle when possessed (degrees, negative = look down).
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Camera
PossessCameraLagSpeed¶
Camera position lag speed. Lower = smoother, higher = snappier.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Camera
PossessCameraRotationLagSpeed¶
Camera rotation lag speed. Lower = smoother.
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Camera
PossessCameraOffset¶
Vertical offset above body center (cm). Reduces vertical bounce from walking/trotting.
- Type: FVector
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Camera
ControlSource¶
Determines whether this specific articulation is controlled by ZMQ or UI/Blueprints.
- Type: uint8
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Runtime
OnCollision¶
Fires when a collision occurs involving geoms of this articulation.
- Type: FOnMjCollision
- Category: MuJoCo|Events
bAttachFailed¶
True if mjs_attach failed during Setup. This articulation has no compiled representation.
- Type: bool
- Blueprint: 🟢 ReadOnly
- Category: MuJoCo|Status
MuJoCoXMLFile¶
Optional: Path to an existing MuJoCo XML to import.
- Type: FFilePath
- Editor: ✏️ EditAnywhere
- Category: MuJoCo Import
SimOptions¶
Simulation options for this articulation's child spec.
- Type: FMuJoCoOptions
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Options
DefaultSceneRoot¶
- Type: class USceneComponent*
- Editor: 👁 VisibleAnywhere
- Blueprint: 🟢 ReadOnly
- Category: MjArticulation
Functions¶
Public Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
ShouldTickIfViewportsOnly() |
bool |
Allow ticking in editor viewports when debug drawing is enabled. |
UpdateGroup3Visibility() |
void | Updates the visibility of all Group 3 geoms based on bShowGroup3. |
GetRuntimeComponents() |
template<typename T> void |
Templated helper to find all components of type T belonging to this articulation |
GetComponentByMjId() |
UMjComponent* |
Gets any UMjComponent by its MuJoCo objective type and ID. |
PossessedBy() |
void | Adds twist mapping context on possession. |
UnPossessed() |
void | Removes twist mapping context and zeros twist state on release. |
Setup() |
void | Initializes the articulation, adding its components to the provided mjSpec. |
PostSetup() |
void | Finalizes setup after compilation, resolving indices and bindings. |
DrawDebugCollision() |
void | draws debug lines for collision geoms. |
DrawDebugJoints() |
void | draws joint axis lines and range arcs. |
DrawDebugSites() |
void | draws site location markers. |
ShouldTickIfViewportsOnly¶
Allow ticking in editor viewports when debug drawing is enabled.
- Signature:
ShouldTickIfViewportsOnly() - Returns: bool
UpdateGroup3Visibility¶
Updates the visibility of all Group 3 geoms based on bShowGroup3.
- Signature:
UpdateGroup3Visibility()
GetRuntimeComponents¶
Templated helper to find all components of type T belonging to this articulation
- Signature:
GetRuntimeComponents(TArray<T*>&OutComponents) - Returns: template
void
GetComponentByMjId¶
Gets any UMjComponent by its MuJoCo objective type and ID.
- Signature:
GetComponentByMjId(mjtObjtype,int32id) - Returns: UMjComponent*
PossessedBy¶
Adds twist mapping context on possession.
- Signature:
PossessedBy(AController*NewController)
UnPossessed¶
Removes twist mapping context and zeros twist state on release.
- Signature:
UnPossessed()
Setup¶
Initializes the articulation, adding its components to the provided mjSpec.
- Signature:
Setup(mjSpec*Spec,mjVFS*VFS)
PostSetup¶
Finalizes setup after compilation, resolving indices and bindings.
- Signature:
PostSetup(mjModel*Model,mjData*Data)
MuJoCo|Discovery¶
| Function | Returns | Description |
|---|---|---|
GetRuntimeComponentsOfClass() |
TArray<USceneComponent*> |
Returns all components of a specific class that are not marked as 'bIsDefault'. |
GetRuntimeComponentsOfClass¶
Returns all components of a specific class that are not marked as 'bIsDefault'.
- Signature:
GetRuntimeComponentsOfClass(TSubclassOf<USceneComponent>ComponentClass) - Blueprint: 🔵 Callable
- Returns: TArray
MuJoCo|Keyframes¶
| Function | Returns | Description |
|---|---|---|
GetKeyframeNames() |
TArray<FString> |
Returns the names of all keyframes on this articulation. |
ResetToKeyframe() |
bool |
Resets simulation state to a named keyframe (one-shot teleport). |
HoldKeyframe() |
bool |
Starts continuously driving actuators to hold a keyframe's joint positions. |
StopHoldKeyframe() |
void | Stops holding a keyframe. Actuators return to normal control source. |
IsHoldingKeyframe() |
bool |
Returns true if currently holding a keyframe pose. |
GetKeyframeNames¶
Returns the names of all keyframes on this articulation.
- Signature:
GetKeyframeNames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray
ResetToKeyframe¶
Resets simulation state to a named keyframe (one-shot teleport).
- Signature:
ResetToKeyframe(const FString&KeyframeName) - Blueprint: 🔵 Callable
- Returns: bool
HoldKeyframe¶
Starts continuously driving actuators to hold a keyframe's joint positions.
- Signature:
HoldKeyframe(const FString&KeyframeName) - Blueprint: 🔵 Callable
- Returns: bool
StopHoldKeyframe¶
Stops holding a keyframe. Actuators return to normal control source.
- Signature:
StopHoldKeyframe() - Blueprint: 🔵 Callable
IsHoldingKeyframe¶
Returns true if currently holding a keyframe pose.
- Signature:
IsHoldingKeyframe() - Blueprint: 💎 Pure
- Returns: bool
MuJoCo|Runtime¶
| Function | Returns | Description |
|---|---|---|
ApplyControls() |
void | Applies values from ActuatorControls map to the running m_data->ctrl buffer. |
GetActuators() |
TArray<UMjActuator*> | Returns an array of all UMjActuator components on this articulation. |
GetJoints() |
TArray<UMjJoint*> | Returns an array of all UMjJoint components on this articulation. |
GetSensors() |
TArray<UMjSensor*> | Returns an array of all UMjSensor components on this articulation. |
GetBodies() |
TArray<UMjBody*> | Returns an array of all UMjBody components on this articulation. |
GetFrames() |
TArray<UMjFrame*> | Returns an array of all UMjFrame components on this articulation. |
GetGeoms() |
TArray<UMjGeom*> | Returns an array of all UMjGeom components on this articulation. |
GetActuatorNames() |
TArray<FString> |
Returns the UE component names of all actuators on this articulation. |
GetJointNames() |
TArray<FString> |
Returns the UE component names of all joints on this articulation. |
GetSensorNames() |
TArray<FString> |
Returns the UE component names of all sensors on this articulation. |
GetBodyNames() |
TArray<FString> |
Returns the UE component names of all MjBody components on this articulation. |
GetActuator() |
UMjActuator* | Gets the UMjActuator component by its UE component name. Returns nullptr if not found. |
GetJoint() |
UMjJoint* | Gets the UMjJoint component by its UE component name. Returns nullptr if not found. |
GetSensor() |
UMjSensor* | Gets the UMjSensor component by its UE component name. Returns nullptr if not found. |
GetBody() |
UMjBody* | Gets the UMjBody component by its UE component name. Returns nullptr if not found. |
GetTendons() |
TArray<UMjTendon*> | Returns an array of all UMjTendon components on this articulation. |
GetTendonNames() |
TArray<FString> |
Returns the UE component names of all tendons on this articulation. |
GetTendon() |
UMjTendon* | Gets the UMjTendon component by its UE component name. Returns nullptr if not found. |
GetEqualities() |
TArray<UMjEquality*> | Returns an array of all UMjEquality components on this articulation. |
GetKeyframes() |
TArray<UMjKeyframe*> | Returns an array of all UMjKeyframe components on this articulation. |
GetBodyByMjId() |
UMjBody* | Gets a UMjBody component by its MuJoCo Body ID. |
GetGeomByMjId() |
UMjGeom* | Gets a UMjGeom component by its MuJoCo Geom ID. |
ApplyControls¶
Applies values from ActuatorControls map to the running m_data->ctrl buffer.
- Signature:
ApplyControls() - Blueprint: 🔵 Callable
GetActuators¶
Returns an array of all UMjActuator components on this articulation.
- Signature:
GetActuators() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjActuator*>
GetJoints¶
Returns an array of all UMjJoint components on this articulation.
- Signature:
GetJoints() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjJoint*>
GetSensors¶
Returns an array of all UMjSensor components on this articulation.
- Signature:
GetSensors() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjSensor*>
GetBodies¶
Returns an array of all UMjBody components on this articulation.
- Signature:
GetBodies() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjBody*>
GetFrames¶
Returns an array of all UMjFrame components on this articulation.
- Signature:
GetFrames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjFrame*>
GetGeoms¶
Returns an array of all UMjGeom components on this articulation.
- Signature:
GetGeoms() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjGeom*>
GetActuatorNames¶
Returns the UE component names of all actuators on this articulation.
- Signature:
GetActuatorNames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray
GetJointNames¶
Returns the UE component names of all joints on this articulation.
- Signature:
GetJointNames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray
GetSensorNames¶
Returns the UE component names of all sensors on this articulation.
- Signature:
GetSensorNames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray
GetBodyNames¶
Returns the UE component names of all MjBody components on this articulation.
- Signature:
GetBodyNames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray
GetActuator¶
Gets the UMjActuator component by its UE component name. Returns nullptr if not found.
- Signature:
GetActuator(const FString&Name) - Blueprint: 🔵 Callable
- Returns: UMjActuator*
GetJoint¶
Gets the UMjJoint component by its UE component name. Returns nullptr if not found.
- Signature:
GetJoint(const FString&Name) - Blueprint: 🔵 Callable
- Returns: UMjJoint*
GetSensor¶
Gets the UMjSensor component by its UE component name. Returns nullptr if not found.
- Signature:
GetSensor(const FString&Name) - Blueprint: 🔵 Callable
- Returns: UMjSensor*
GetBody¶
Gets the UMjBody component by its UE component name. Returns nullptr if not found.
- Signature:
GetBody(const FString&Name) - Blueprint: 🔵 Callable
- Returns: UMjBody*
GetTendons¶
Returns an array of all UMjTendon components on this articulation.
- Signature:
GetTendons() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjTendon*>
GetTendonNames¶
Returns the UE component names of all tendons on this articulation.
- Signature:
GetTendonNames() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray
GetTendon¶
Gets the UMjTendon component by its UE component name. Returns nullptr if not found.
- Signature:
GetTendon(const FString&Name) - Blueprint: 🔵 Callable
- Returns: UMjTendon*
GetEqualities¶
Returns an array of all UMjEquality components on this articulation.
- Signature:
GetEqualities() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjEquality*>
GetKeyframes¶
Returns an array of all UMjKeyframe components on this articulation.
- Signature:
GetKeyframes() - Blueprint: 🔵 Callable 💎 Pure
- Returns: TArray<UMjKeyframe*>
GetBodyByMjId¶
Gets a UMjBody component by its MuJoCo Body ID.
- Signature:
GetBodyByMjId(int32id) - Blueprint: 🔵 Callable
- Returns: UMjBody*
GetGeomByMjId¶
Gets a UMjGeom component by its MuJoCo Geom ID.
- Signature:
GetGeomByMjId(int32id) - Blueprint: 🔵 Callable
- Returns: UMjGeom*
MuJoCo|Runtime|Actuators¶
| Function | Returns | Description |
|---|---|---|
SetActuatorControl() |
bool |
Sets a single actuator's control value by component name. Returns false if not found. |
GetActuatorRange() |
FVector2D |
Gets an actuator's control range [min, max] by component name. |
SetActuatorControl¶
Sets a single actuator's control value by component name. Returns false if not found.
- Signature:
SetActuatorControl(const FString&ActuatorName,floatValue) - Blueprint: 🔵 Callable
- Returns: bool
GetActuatorRange¶
Gets an actuator's control range [min, max] by component name.
- Signature:
GetActuatorRange(const FString&ActuatorName) - Blueprint: 🔵 Callable
- Returns: FVector2D
MuJoCo|Runtime|Joints¶
| Function | Returns | Description |
|---|---|---|
GetJointAngle() |
float |
Gets a joint's position (qpos) by component name. Returns 0 if not found. |
GetJointAngle¶
Gets a joint's position (qpos) by component name. Returns 0 if not found.
- Signature:
GetJointAngle(const FString&JointName) - Blueprint: 🔵 Callable
- Returns: float
MuJoCo|Runtime|Sensors¶
| Function | Returns | Description |
|---|---|---|
GetSensorScalar() |
float |
Gets a sensor's scalar reading by component name. Returns 0 if not found. |
GetSensorReading() |
TArray<float> |
Gets a sensor's full reading array by component name. Returns empty if not found. |
GetSensorScalar¶
Gets a sensor's scalar reading by component name. Returns 0 if not found.
- Signature:
GetSensorScalar(const FString&SensorName) - Blueprint: 🔵 Callable
- Returns: float
GetSensorReading¶
Gets a sensor's full reading array by component name. Returns empty if not found.
- Signature:
GetSensorReading(const FString&SensorName) - Blueprint: 🔵 Callable
- Returns: TArray
MuJoCo|Sleep¶
| Function | Returns | Description |
|---|---|---|
WakeAll() |
void | Wakes all bodies in this articulation (MuJoCo 3.4+). |
SleepAll() |
void | Forces all bodies in this articulation to sleep (MuJoCo 3.4+). |
WakeAll¶
Wakes all bodies in this articulation (MuJoCo 3.4+).
- Signature:
WakeAll() - Blueprint: 🔵 Callable
SleepAll¶
Forces all bodies in this articulation to sleep (MuJoCo 3.4+).
- Signature:
SleepAll() - Blueprint: 🔵 Callable
MuJoCo|Validation¶
| Function | Returns | Description |
|---|---|---|
ValidateSpec() |
void | Validates the articulation's MuJoCo spec by attempting a temporary compile. |
ValidateSpec¶
Validates the articulation's MuJoCo spec by attempting a temporary compile.
- Signature:
ValidateSpec() - Blueprint: 🔵 Callable 🔧 CallInEditor
MuJoCo|Visuals¶
| Function | Returns | Description |
|---|---|---|
ToggleGroup3Visibility() |
void | Editor button to toggle Group 3 visibility. |
ToggleGroup3Visibility¶
Editor button to toggle Group 3 visibility.
- Signature:
ToggleGroup3Visibility() - Blueprint: 🔧 CallInEditor
Protected Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
EndPlay() |
void | Called when the game ends or actor is destroyed. |
SetupPlayerInputComponent() |
void | Binds twist controller input when possessed. |
EndPlay¶
Called when the game ends or actor is destroyed.
- Signature:
EndPlay(const EEndPlayReason::TypeEndPlayReason)
SetupPlayerInputComponent¶
Binds twist controller input when possessed.
- Signature:
SetupPlayerInputComponent(UInputComponent*PlayerInputComponent)