Focused reference · Unreal Engine 5.8
Action patterns
Constant-speed actor movement
Variables:
DistanceCm— floatSpeedCmPerSec— floatDirection—1.0or-1.0Loop— boolOrientToSpline— bool
Per update:
Length = Spline -> Get Spline Length.DistanceCm += SpeedCmPerSec * Direction * DeltaSeconds.- Loop: wrap into
[0, Length); non-loop: clamp into[0, Length]. Get Transform at Distance Along Splinein World space.- If orientation is disabled, use only returned location.
- Apply with
Set Actor Transformor move the intended component. - Define end behavior explicitly: stop, loop, reverse, fire event, or dwell.
Do not drive constant speed with Get Location at Spline Input Key plus a linearly
increasing key. Parametric distance is not guaranteed to be uniform.
Closest progress to an actor
- Read actor world location.
- Use
Get Distance Along Spline at Locationwith World coordinate space. - Use the returned distance for progress, ordering, or a subsequent transform query.
- If the spline crosses itself, retain previous progress and constrain how far the result may jump between updates.
Rigid objects at uniform intervals
- Get spline length.
- Choose either:
- fixed maximum spacing:
count = ceil(length / maxSpacing); - approximately target spacing with even end fit:
count = round(length / targetSpacing).
- fixed maximum spacing:
- Compute
actualSpacing = length / max(1, count). - Iterate
0..countwhen both endpoints need objects; otherwise0..count-1. - Query transform at
index * actualSpacing. - Add an ISM/HISM instance for repeated meshes; spawn actors only when each instance needs independent behavior.
- Apply lateral offset in the sampled transform's right-vector direction.
Continuous deformed mesh
For each consecutive pair of spline points:
- Create or reuse one Spline Mesh Component.
- Query start/end locations and tangents in the spline owner's Local space.
- Assign the static mesh and
Forward Axis. - Call
Set Start and Endwith start position/tangent and end position/tangent. - Apply start/end scale or roll only if required by the design.
- Register the component when created at runtime.
- Store generated components in an array. Destroy/clear them before regeneration.
For a closed loop, include the last-to-first segment.
Editable Blueprint generator
Recommended layout:
- Actor root
- Spline Component
- Exposed mesh/material/spacing/width/collision variables
GeneratedComponentsarrayRebuildfunction used by Construction Script and explicit runtime updates
Rebuild:
- Destroy or clear previously generated components/instances.
- Validate spline point count and assets.
- Generate deterministically from current spline data.
- Do not modify the designer's control points unless that is the tool's explicit job.
Landscape road
- Enter Landscape Manage mode and select Spline.
- Create/join/split control points and segments.
- Add a dedicated Spline Edit Layer before expecting heightmap deformation.
- Set segment mesh, width, side falloff, layer name, and raise/lower behavior.
- Snap points to Landscape where appropriate.
- Inspect intersections, steep grades, tangents, and material paint transitions.
PCG spline authoring in UE 5.8
- Enable and enter PCG Editor Mode.
- Use Draw Spline for roads, fences, and line placement.
- Use Draw Spline Surface for closed fields or bounded scattering.
- Use graph refresh-rate controls when interactive generation is expensive.
- Use
Apply Spline to Componentwhen PCG must update an existing Spline Component. - Mark the workflow experimental in production documentation and provide a fallback.