RealDocs

USplineComponent

class Engine Blueprint Since 4.0
#include "Components/SplineComponent.h"

Description

A component that defines a curved path through space using Hermite spline points. Used for roads, rails, follower paths, cables, and any situation requiring smooth spatial interpolation along a curve.

Caveats & Gotchas

  • Spline points are stored in local space by default. When querying positions, always specify the coordinate space explicitly to avoid subtle bugs.
  • UpdateSpline() is expensive — defer it by passing bUpdateSpline=false when adding many points in a loop, then call UpdateSpline() once after.
  • USplineComponent does not automatically move anything — it only defines a path. Pair it with a timeline or tick to move actors along it.

Example

Add points and query a position along the spline C++
SplineComponent->ClearSplinePoints(false);
SplineComponent->AddSplinePoint(FVector(0, 0, 0), ESplineCoordinateSpace::World, false);
SplineComponent->AddSplinePoint(FVector(500, 0, 200), ESplineCoordinateSpace::World, false);
SplineComponent->AddSplinePoint(FVector(1000, 0, 0), ESplineCoordinateSpace::World);

float HalfLength = SplineComponent->GetSplineLength() * 0.5f;
FVector MidPoint = SplineComponent->GetLocationAtDistanceAlongSpline(HalfLength, ESplineCoordinateSpace::World);

Functions (4)

Transform
1
Access Type Name
public function USplineComponent::GetLocationAtDistanceAlongSpline
Utility
3
Access Type Name
public function USplineComponent::AddSplinePoint
public function USplineComponent::GetDirectionAtDistanceAlongSpline
public function USplineComponent::GetSplineLength

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.