Orrery Terrain · OrreryTerrain module · class
UOrreryTerrainSculptComponent
Turns a player's pointer into sculpt strokes: the sample input component for player sculpting, shaped like rail's URailConstructionInputComponent.
Declaration
UCLASS(Blueprintable, ClassGroup=(Orrery), meta=(),
HideCategories=(Variable, Tags, ComponentReplication, Activation, Cooking, AssetUserData))
class UOrreryTerrainSculptComponent : public UActorComponent- Header
#include "OrreryTerrainSculptComponent.h"- Module
PublicDependencyModuleNames.Add("OrreryTerrain");in your module’s Build.cs.- Stability
- Stable: changes within a major version only add.
- Thread
- Game thread.
- Derives from
UActorComponent- Blueprint
- “Orrery Terrain Sculpt Component”, a Blueprint type; Blueprints can derive from it
Description
Drop it on a PlayerController and bind the verbs to input. While a drag is held it resolves the cursor every tick with the terrain's analytic raycast (never a physics trace, so it can hit nothing but ground), and applies brush steps at a fixed StepRateHz, whatever the frame rate: the strength is per step, so a 30 fps and a 144 fps player move the same earth per second.
⚑ It binds no keys. The plugin owns the meaning of input; the game owns its capture.
Authority seam. With bRouteCommandsExternally, a step raises OnCommandRequested with the encoded request instead of applying it; the game sends it to the server, whose subsystem applies it with ApplySculptRecord and broadcasts the authority's record to every replica. On a replica under the built-in replication (UOrreryTerrainNetSubsystem) the component routes its steps, undo and redo to the server by itself, without the flag.
One Ctrl+Z across tools is the game's to build: undo goes to the tool the player used last. Keep a "who edited last" marker, and send Ctrl+Z to that tool's Undo(). The component builds no global history.
Cold ground (G7a). A step whose ground is still loading (the subsystem answers Pending) is queued, never dropped: the component keeps the steps in order and retries the oldest on later ticks until it applies, then drains the rest, at most OrreryTerrain.Sculpt.QueueDrainPerTick per tick. While anything waits, every later verb (a step, the release, the next press, Undo, Redo) queues behind it, so a stroke on cold ground ends in the same StateHash as on resident ground; the release closes the stroke once its steps are in. Limits, each logged once per stroke: at OrreryTerrain.Sculpt.QueuedStepsMax steps the stroke stalls (steps due while the queue is full are not taken, as when the cursor leaves the ground); if the oldest step waits OrreryTerrain.Sculpt.QueueTimeout seconds, the waiting steps are given up and the stroke closes; EndPlay applies what it can and gives up the rest. Local strokes only: a routed request is the authority's to apply.
Game thread. World positions are Unreal units (cm); the subsystem converts to the terrain's fixed point once, on the authority.
Functions
- UOrreryTerrainSculptComponent
- TickComponent
Resolves the cursor and, while dragging, applies the steps due since the last tick.
- EndPlay
Ends an open stroke, so the ring and the collision refresh are never left mid-stroke.
- GetCustomCursorRay
Supply the cursor ray yourself.
- PushCursorWorldPositionBlueprint
Supply a resolved cursor directly, skipping ray resolution (External source, and tests).
- ResolveMaskAnglestatic
The angle one dab uses, degrees: the pure rule behind RotationMode.
- StampOnceBlueprint
Apply one brush as a one-dab stroke at once: a stamp.
- SetSplatBlueprint
Make the brush a splat: each stroke step of a drag, and SplatOnce, lays up to four masked Paint steps (red to alpha) at the dab's centre and angle instead of one brush step.
- ClearSplatBlueprint
Return to the plain brush: a drag lays Brush again.
- GetSplatBlueprint
The splat a drag lays; empty when the brush is not a splat.
- SplatOnce
Lay the splat once as a one-dab stroke (one undo): local it opens a stroke, applies ApplySplat and ends it; routed (a replica, or bRouteCommandsExternally) it sends the Begin, one Brush request per used channel, and End.
- GetDabCountBlueprint
Dabs the current or last drag has taken, the first one included.
- BeginDragBlueprint
Press: open a stroke at the cursor and apply its first step.
- EndDragBlueprint
Release: apply the last partial step (one step at the cursor when time has passed since the previous step), then close the stroke (its volumes arrive on OnStrokeEndedBP).
- UndoBlueprint
Undo the newest stroke in the terrain's ring (ends an open drag first).
- RedoBlueprint
Redo the stroke the last Undo took back; queued like Undo while steps wait.
- SetBrushKindBlueprint
- ScaleRadiusBlueprint
Multiply the radius (mouse wheel), clamped to the terrain's sculpt limits.
- IsDraggingBlueprint
- HasCursorTargetBlueprint
False when the cursor ray missed the ground; the brush outline should not be drawn.
- GetCursorWorldPositionBlueprint
- GetQueuedStepsBlueprint
Brush steps waiting for the ground under them to load.
- IsWaitingForGroundBlueprint
True while anything waits for cold ground: steps, or a release, press, Undo or Redo queued behind them.
- GetTerrainBlueprint
Properties
| Name | Type | Default | Meaning |
|---|---|---|---|
CursorBlueprintReadWrite | EOrrery | EOrrery | — |
TraceBlueprintReadWrite | double | 1.0e6 | Ray length, cm. |
BrushBlueprintReadWrite | FOrrery | — | The brush applied at the cursor. Centre is overwritten each step; Radius and Strength are cm. |
StepBlueprintReadWrite | float | 30.f | Brush steps per second while dragging; Strength is per step. |
StepBlueprintReadWrite | EOrrery | EOrrery | Whether steps come at StepRateHz or by distance travelled (Spacing). Masked brushes read better with Spacing. |
SpacingBlueprintReadWrite | double | 0.25 | Spacing mode: the distance between steps as a fraction of the brush radius (0.25 puts four dabs in one radius). |
RotationBlueprintReadWrite | EOrrery | EOrrery | How each dab turns its mask; Brush.MaskAngle is the base. |
RandomBlueprintReadWrite | double | 180.0 | Random rotation: each dab's angle is Brush.MaskAngle plus or minus up to this many degrees (180 turns the mask any way). |
bBlueprintReadWrite | bool | true | Flatten and Stamp: take the target height from the ground under the cursor when the drag begins. |
bBlueprintReadWrite | bool | false | Raise OnCommandRequested instead of applying steps here. Undo and Redo are requests too. |
OnBlueprintAssignable | FOn | — | An encoded sculpt request (begin, step, end, undo or redo), for the game to send to the server. |
Blueprint
- Bind Event to On Command RequestedOrrery › Terrain › Sculpt › Network
- Begin DragOrrery › Terrain › Sculpt
- Clear SplatOrrery › Terrain › Sculpt › Brush
- End DragOrrery › Terrain › Sculpt
- Get Cursor World PositionOrrery › Terrain › Sculpt
- Get Dab CountOrrery › Terrain › Sculpt
- Get Queued StepsOrrery › Terrain › Sculpt
- Get SplatOrrery › Terrain › Sculpt › Brush
- Get TerrainOrrery › Terrain › Sculpt
- Has Cursor TargetOrrery › Terrain › Sculpt
- Is DraggingOrrery › Terrain › Sculpt
- Is Waiting for GroundOrrery › Terrain › Sculpt
- Push Cursor World PositionOrrery › Terrain › Sculpt › Cursor
- RedoOrrery › Terrain › Sculpt
- Scale RadiusOrrery › Terrain › Sculpt › Brush
- Set Brush KindOrrery › Terrain › Sculpt › Brush
- Set SplatOrrery › Terrain › Sculpt › Brush
- Stamp OnceOrrery › Terrain › Sculpt
- UndoOrrery › Terrain › Sculpt