Skip to content

UMjTwistController

Captures WASD/gamepad input and stores twist commands (vx, vy, yaw_rate)

for broadcasting over ZMQ. Add to an AMjArticulation to enable possession-based control. Thread-safe: game thread writes twist state via input callbacks, physics thread reads via GetTwist() for ZMQ broadcast.

Attribute Value
Kind Class
UE Macro UCLASS
Inherits UActorComponent
Blueprint Spawnable ✅ Yes

Properties

Public Properties

Property Type Description
TwistMappingContext UInputMappingContext*
MoveAction UInputAction*
TurnAction UInputAction*
ActionKeys TArray<UInputAction*>
MaxVx float Maximum forward/backward speed (m/s). Full stick or W/S produces this velocity.
MaxVy float Maximum strafe speed (m/s). Full stick or A/D produces this velocity.
MaxYawRate float Maximum yaw rate (rad/s). Full stick or Q/E produces this rate.

TwistMappingContext

  • Type: UInputMappingContext*
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Input

MoveAction

  • Type: UInputAction*
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Input

TurnAction

  • Type: UInputAction*
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Input

ActionKeys

  • Type: TArray
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Input

MaxVx

Maximum forward/backward speed (m/s). Full stick or W/S produces this velocity.

  • Type: float
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Twist

MaxVy

Maximum strafe speed (m/s). Full stick or A/D produces this velocity.

  • Type: float
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Twist

MaxYawRate

Maximum yaw rate (rad/s). Full stick or Q/E produces this rate.

  • Type: float
  • Editor: ✏️ EditAnywhere
  • Blueprint: 🔵 ReadWrite
  • Category: MuJoCo|Twist

Functions

Public Functions

General

Function Returns Description
GetTwist() FVector Returns current twist as FVector(Vx, Vy, YawRate) in m/s and rad/s. Thread-safe.
GetActiveActions() int32 Returns bitmask of currently pressed action keys (bits 0-9). Thread-safe.
BindInput() void Bind input actions to an EnhancedInputComponent. Called from AMjArticulation::SetupPlayerInputComponent.
ResetTwist() void Zero all twist state. Called when unpossessed.
GetTwist

Returns current twist as FVector(Vx, Vy, YawRate) in m/s and rad/s. Thread-safe.

  • Signature: GetTwist()
  • Returns: FVector
GetActiveActions

Returns bitmask of currently pressed action keys (bits 0-9). Thread-safe.

  • Signature: GetActiveActions()
  • Returns: int32
BindInput

Bind input actions to an EnhancedInputComponent. Called from AMjArticulation::SetupPlayerInputComponent.

  • Signature: BindInput(UEnhancedInputComponent* EIC)
ResetTwist

Zero all twist state. Called when unpossessed.

  • Signature: ResetTwist()