RealDocs

USplineComponent::GetSplineLength

function Engine Blueprint Since 4.0
#include "Components/SplineComponent.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableconst

Description

Returns the total arc length of the spline in world units. Use this to normalise distances when moving along the spline.

Signature

ENGINE_API float GetSplineLength() const

Return Type

float

Caveats & Gotchas

  • Length is computed from the spline's curve approximation and updates only when UpdateSpline() is called. If you modify points without triggering an update, GetSplineLength() returns a stale value.
  • Returns 0 if the spline has fewer than 2 points.

Example

Convert a 0-1 alpha to a world-space position C++
float Alpha = 0.75f; // 75% along the spline
float Distance = SplineComponent->GetSplineLength() * Alpha;
FVector Pos = SplineComponent->GetLocationAtDistanceAlongSpline(Distance, ESplineCoordinateSpace::World);

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.