AMjHeightfieldActor¶
An actor that samples terrain height within its bounding box and registers
the result as a MuJoCo heightfield asset (mjsHField) into the shared mjSpec.
Place this actor in the level over any landscape / static geometry. The Manager
will auto-detect it during PreCompile() via a Cast
| Attribute | Value |
|---|---|
| Kind | Class |
| UE Macro | UCLASS |
| Inherits | AActor |
Properties¶
Public Properties¶
| Property | Type | Description |
|---|---|---|
Resolution |
int32 |
Number of sample points along each axis (Resolution x Resolution grid). |
HFieldName |
FString |
Name used to register the heightfield asset in the MuJoCo spec. |
ElevationTraceChannel |
TEnumAsByte<ECollisionChannel> |
Collision channel to use for downward height raycasts. |
bForceRecache |
bool |
Force re-sampling on next compile, ignoring any cached heightfield data. |
TraceWhitelist |
TArray<TSoftObjectPtr<AActor>> |
Whitelist of actors to trace against for height sampling. |
BaseThickness |
float |
Thickness of the solid base below the heightfield surface, expressed |
bShowGrid |
bool |
If true, a grid preview is rendered in the editor viewport. |
GridColor |
FLinearColor |
Color used to draw the resolution grid lines. |
BoundsBox |
UBoxComponent* |
Root box component — defines the sampling region. Scale/move this in the editor. |
GridLines |
ULineBatchComponent* |
Line batch used to draw the resolution grid in the editor. |
Resolution¶
Number of sample points along each axis (Resolution x Resolution grid).
- Type: int32
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield
HFieldName¶
Name used to register the heightfield asset in the MuJoCo spec.
- Type: FString
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield
ElevationTraceChannel¶
Collision channel to use for downward height raycasts.
- Type: TEnumAsByte
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield
bForceRecache¶
Force re-sampling on next compile, ignoring any cached heightfield data.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield
TraceWhitelist¶
Whitelist of actors to trace against for height sampling.
- Type: TArray
> - Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield
BaseThickness¶
Thickness of the solid base below the heightfield surface, expressed
- Type: float
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield
bShowGrid¶
If true, a grid preview is rendered in the editor viewport.
- Type: bool
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield|Visualizer
GridColor¶
Color used to draw the resolution grid lines.
- Type: FLinearColor
- Editor: ✏️ EditAnywhere
- Blueprint: 🔵 ReadWrite
- Category: MuJoCo|Heightfield|Visualizer
BoundsBox¶
Root box component — defines the sampling region. Scale/move this in the editor.
- Type: UBoxComponent*
- Editor: 👁 VisibleAnywhere
- Blueprint: 🟢 ReadOnly
- Category: MuJoCo|Heightfield
GridLines¶
Line batch used to draw the resolution grid in the editor.
- Type: ULineBatchComponent*
- Editor: 👁 VisibleAnywhere
- Blueprint: 🟢 ReadOnly
- Category: MuJoCo|Heightfield|Visualizer
Functions¶
Public Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
Setup() |
void | Called by AMuJoCoManager::PreCompile(). Raycasts the terrain under the |
PostSetup() |
void | Called by AMuJoCoManager::PostCompile(). Currently a no-op for static terrain. |
Setup¶
Called by AMuJoCoManager::PreCompile(). Raycasts the terrain under the
- Signature:
Setup(mjSpec*Spec,mjVFS*VFS)
PostSetup¶
Called by AMuJoCoManager::PostCompile(). Currently a no-op for static terrain.
- Signature:
PostSetup(mjModel*Model,mjData*Data)
Protected Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
OnConstruction() |
void | Called when the actor is constructed or a property changes in the editor. |
OnConstruction¶
Called when the actor is constructed or a property changes in the editor.
- Signature:
OnConstruction(const FTransform&Transform)
Private Functions¶
General¶
| Function | Returns | Description |
|---|---|---|
RebuildGridVisualizer() |
void | Rebuilds the GridLines component to reflect the current Resolution and bounds. |
SampleHeightAt() |
float |
Traces downward to find the terrain height, ignoring MuJoCo actors. |
GetCacheFilePath() |
FString |
Returns the cache file path for this heightfield. |
ComputeCacheKey() |
FString |
Computes a cache key from actor transform, resolution, and bounds. |
SaveCache() |
bool |
Saves sampled heightfield data to a binary cache file. |
LoadCache() |
bool |
Loads cached heightfield data. Returns true if cache is valid. |
RebuildGridVisualizer¶
Rebuilds the GridLines component to reflect the current Resolution and bounds.
- Signature:
RebuildGridVisualizer()
SampleHeightAt¶
Traces downward to find the terrain height, ignoring MuJoCo actors.
- Signature:
SampleHeightAt(const FVector2D&WorldXY,const FBox&Bounds) - Returns: float
GetCacheFilePath¶
Returns the cache file path for this heightfield.
- Signature:
GetCacheFilePath() - Returns: FString
ComputeCacheKey¶
Computes a cache key from actor transform, resolution, and bounds.
- Signature:
ComputeCacheKey() - Returns: FString
SaveCache¶
Saves sampled heightfield data to a binary cache file.
- Signature:
SaveCache(const TArray<float>&NormHeights,floatMinH,floatElevRange,const FBox&Bounds,const FString&CacheKey) - Returns: bool
LoadCache¶
Loads cached heightfield data. Returns true if cache is valid.
- Signature:
LoadCache(TArray<float>&OutNormHeights,float&OutMinH,float&OutElevRange,FBox&OutBounds,const FString&ExpectedCacheKey) - Returns: bool