USplineComponent::AddSplinePoint
#include "Components/SplineComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Appends a new point at the end of the spline. The point's tangents are computed automatically to maintain a smooth curve.
Signature
ENGINE_API void AddSplinePoint(const FVector& Position, ESplineCoordinateSpace::Type CoordinateSpace, bool bUpdateSpline = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Position | const FVector& | The position of the new spline point. | — |
| CoordinateSpace | ESplineCoordinateSpace::Type | Whether Position is in world space or local space. | — |
| bUpdateSpline | bool | If true, rebuilds the spline immediately after adding the point. | true |
Return Type
void Caveats & Gotchas
- • Passing bUpdateSpline=true on every call when adding many points is expensive. Pass false and call UpdateSpline() manually once after the loop.
- • Points are appended to the end — use AddSplinePointAtIndex to insert at a specific position.
- • Tangent generation is automatic (Linear or Curve depending on SplineType). To set custom tangents, use SetTangentAtSplinePoint after adding the point.
Example
Build a spline from an array of positions C++
SplineComponent->ClearSplinePoints(false);
for (const FVector& Pos : PathPoints)
{
SplineComponent->AddSplinePoint(Pos, ESplineCoordinateSpace::World, false);
}
SplineComponent->UpdateSpline(); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?