USplineComponent

A spline component is a spline shape which can be used for other purposes (e.g. animating objects).

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Components/SplineComponent.h

Include

#include "Components/SplineComponent.h"

Syntax

class USplineComponent : public UPrimitiveComponent

Remarks

A spline component is a spline shape which can be used for other purposes (e.g. animating objects). It contains debug rendering capabilities.

Variables

Name Description

Public variable

bool

 

bAllowDiscontinuousSpline

Whether the spline's leave and arrive tangents can be different

Public variable

bool

 

bDrawDebug

If true, the spline will be rendered if the Splines showflag is set.

Public variable

bool

 

bInputSplinePointsToConstructionScript

Whether the spline points should be passed to the User Construction Script so they can be further manipulated by it.

Public variable

bool

 

bModifiedByConstructionScript

Whether the UCS has made changes to the spline points

Public variable

bool

 

bShouldVisualizeScale

Whether scale visualization should be displayed

Public variable

bool

 

bSplineHasBeenEdited

Whether the spline has been edited from its default by the spline component visualizer

Public variable

bool

 

bStationaryEndpoints

Whether the endpoints of the spline are considered stationary when traversing the spline at non-constant velocity.

Public variable

FVector

 

DefaultUpVector

Default up vector in local space to be used when calculating transforms along the spline

Public variable

float

 

Duration

Specifies the duration of the spline in seconds

Public variable

FLinearColor

 

EditorSelectedSplineSegmentColor

Color of a selected spline component segment in the editor

Public variable

FLinearColor

 

EditorUnselectedSplineSegmentColor

Color of an unselected spline component segment in the editor

Public variable

int32

 

ReparamStepsPerSegment

Number of steps per spline segment to place in the reparameterization table

Public variable

float

 

ScaleVisualizationWidth

Width of spline in editor for use with scale visualization

Public variable

FSplineCurves

 

SplineCurves

Constructors

Name Description

Public function

USplineComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

AddPoint

(
    const FSplinePoint& Point,
    bool bUpdateSpline
)

Adds an FSplinePoint to the spline.

Public function

void

 

AddPoints

(
    const TArray< FSplinePoint >& Poin...,
    bool bUpdateSpline
)

Adds an array of FSplinePoints to the spline.

Public function

void

 

AddSplineLocalPoint

(
    const FVector& Position
)

Adds a local space point to the spline

Public function

void

 

AddSplinePoint

(
    const FVector& Position,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Adds a point to the spline

Public function

void

 

AddSplinePointAtIndex

(
    const FVector& Position,
    int32 Index,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Adds a point to the spline at the specified index

Public function

void

 

AddSplineWorldPoint

(
    const FVector& Position
)

Deprecated method definitions.

Public function

void

 

ApplyComponentInstanceData

(
    FSplineInstanceData* Component...,
    const bool bPostUCS
)

Public function

void

 

ClearSplinePoints

(
    bool bUpdateSpline
)

Clears all the points in the spline

Public function Static

void

 

Draw

(
    FPrimitiveDrawInterface* PDI,
    const FSceneView* View,
    const FInterpCurveVector& SplineIn...,
    const FMatrix& LocalToWorld,
    const FLinearColor& LineColor,
    uint8 DepthPriorityGroup
)

Helper function to draw a vector curve

Public function Const

FVector

 

FindDirectionClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world spcae, return a unit direction vector of the spline tangent closest to the location.

Public function Const

float

 

FindInputKeyClosestToWorldLocation

(
    const FVector& WorldLocation
)

Given a location, in world space, return the input key closest to that location.

Public function Const

FVector

 

FindLocationClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return the point on the curve that is closest to the location.

Public function Const

FQuat

 

FindQuaternionClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return a quaternion corresponding to the spline's rotation closest to the location.

Public function Const

FVector

 

FindRightVectorClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return a unit direction vector corresponding to the spline's right vector closest to the location.

Public function Const

float

 

FindRollClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return the spline's roll closest to the location, in degrees.

Public function Const

FRotator

 

FindRotationClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return rotation corresponding to the spline's rotation closest to the location.

Public function Const

FVector

 

FindScaleClosestToWorldLocation

(
    const FVector& WorldLocation
)

Given a location, in world space, return the spline's scale closest to the location.

Public function Const

FVector

 

FindTangentClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return the tangent vector of the spline closest to the location.

Public function Const

FTransform

 

FindTransformClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseScale
)

Given a location, in world space, return an FTransform closest to that location.

Public function Const

FVector

 

FindUpVectorClosestToWorldLocation

(
    const FVector& WorldLocation,
    ESplineCoordinateSpace::Type Coordi...
)

Given a location, in world space, return a unit direction vector corresponding to the spline's up vector closest to the location.

Public function Const

FVector

 

GetArriveTangentAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the arrive tangent at spline point

Public function Const

FVector

 

GetDefaultUpVector

(
    ESplineCoordinateSpace::Type Coordi...
)

Gets the default up vector used by this spline

Public function Const

FVector

 

GetDirectionAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return a unit direction vector of the spline tangent there.

Public function Const

FVector

 

GetDirectionAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get unit direction along spline at the provided input key value

Public function Const

FVector

 

GetDirectionAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the location at spline point

Public function Const

FVector

 

GetDirectionAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return a unit direction vector of the spline tangent there.

Public function Const

float

 

GetDistanceAlongSplineAtSplinePoint

(
    int32 PointIndex
)

Get the distance along the spline at the spline point

Public function Const

float

 

GetFloatPropertyAtSplineInputKey

(
    float InKey,
    FName PropertyName
)

Get a metadata property float value along the spline at spline input key

Public function Const

float

 

GetFloatPropertyAtSplinePoint

(
    int32 Index,
    FName PropertyName
)

Get a metadata property float value along the spline at spline point

Public function Const

float

 

GetInputKeyAtDistanceAlongSpline

(
    float Distance
)

Given a distance along the length of this spline, return the corresponding input key at that point

Public function Const

FVector

 

GetLeaveTangentAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the leave tangent at spline point

Public function Const

void

 

GetLocalLocationAndTangentAtSplinePoint

(
    int32 PointIndex,
    FVector& LocalLocation,
    FVector& LocalTangent
)

Get local location and tangent at a spline point

Public function Const

void

 

GetLocationAndTangentAtSplinePoint

(
    int32 PointIndex,
    FVector& Location,
    FVector& Tangent,
    ESplineCoordinateSpace::Type Coordi...
)

Get location and tangent at a spline point

Public function Const

FVector

 

GetLocationAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return the point in space where this puts you

Public function Const

FVector

 

GetLocationAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get location along spline at the provided input key value

Public function Const

FVector

 

GetLocationAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the location at spline point

Public function Const

FVector

 

GetLocationAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the point in space where this puts you

Public function Const

int32

 

GetNumberOfSplinePoints()

Get the number of points that make up this spline

Public function Const

int32

 

GetNumberOfSplineSegments()

Get the number of segments that make up this spline

Public function Const

FQuat

 

GetQuaternionAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return a quaternion corresponding to the spline's rotation there.

Public function Const

FQuat

 

GetQuaternionAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get quaternion corresponding to rotation along spline at the provided input key value

Public function Const

FQuat

 

GetQuaternionAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the rotation at spline point as a quaternion

Public function Const

FQuat

 

GetQuaternionAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return a quaternion corresponding to the spline's rotation there.

Public function Const

FVector

 

GetRightVectorAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return a unit direction vector corresponding to the spline's right vector there.

Public function Const

FVector

 

GetRightVectorAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get up vector at the provided input key value

Public function Const

FVector

 

GetRightVectorAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the right vector at spline point

Public function Const

FVector

 

GetRightVectorAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the spline's right vector there.

Public function Const

float

 

GetRollAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return the spline's roll there, in degrees.

Public function Const

float

 

GetRollAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get roll in degrees at the provided input key value

Public function Const

float

 

GetRollAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the amount of roll at spline point, in degrees

Public function Const

float

 

GetRollAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the spline's roll there, in degrees.

Public function Const

FRotator

 

GetRotationAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return a rotation corresponding to the spline's rotation there.

Public function Const

FRotator

 

GetRotationAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get rotator corresponding to rotation along spline at the provided input key value

Public function Const

FRotator

 

GetRotationAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the rotation at spline point as a rotator

Public function Const

FRotator

 

GetRotationAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return a rotation corresponding to the spline's position and direction there.

Public function Const

FVector

 

GetScaleAtDistanceAlongSpline

(
    float Distance
)

Given a distance along the length of this spline, return the spline's scale there.

Public function Const

FVector

 

GetScaleAtSplineInputKey

(
    float InKey
)

Get scale at the provided input key value

Public function Const

FVector

 

GetScaleAtSplinePoint

(
    int32 PointIndex
)

Get the scale at spline point

Public function Const

FVector

 

GetScaleAtTime

(
    float Time,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the spline's scale there.

Public function Const

float

 

GetSplineLength()

Returns total length along this spline

Public function Virtual Const

const USplin...

 

GetSplinePointsMetadata()

Public function Virtual

USplineMetad...

 

GetSplinePointsMetadata()

Public function Const

const FInter...

 

GetSplinePointsPosition()

Public function

FInterpCurve...

 

GetSplinePointsPosition()

Public function Const

const FInter...

 

GetSplinePointsRotation()

Public function

FInterpCurve...

 

GetSplinePointsRotation()

Public function

FInterpCurve...

 

GetSplinePointsScale()

Public function Const

const FInter...

 

GetSplinePointsScale()

Public function Const

ESplinePoint...

 

GetSplinePointType

(
    int32 PointIndex
)

Get the type of a spline point

Public function Const

FVector

 

GetTangentAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return the tangent vector of the spline there.

Public function Const

FVector

 

GetTangentAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get tangent along spline at the provided input key value

Public function Const

FVector

 

GetTangentAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the tangent at spline point. This fetches the Leave tangent of the point.

Public function Const

FVector

 

GetTangentAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the spline's tangent there.

Public function Const

FTransform

 

GetTransformAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseScale
)

Given a distance along the length of this spline, return an FTransform corresponding to that point on the spline.

Public function Const

FTransform

 

GetTransformAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseScale
)

Get transform at the provided input key value

Public function Const

FTransform

 

GetTransformAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseScale
)

Get the transform at spline point

Public function Const

FTransform

 

GetTransformAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity,
    bool bUseScale
)

Given a time from 0 to the spline duration, return the spline's transform at the corresponding position.

Public function Const

FVector

 

GetUpVectorAtDistanceAlongSpline

(
    float Distance,
    ESplineCoordinateSpace::Type Coordi...
)

Given a distance along the length of this spline, return a unit direction vector corresponding to the spline's up vector there.

Public function Const

FVector

 

GetUpVectorAtSplineInputKey

(
    float InKey,
    ESplineCoordinateSpace::Type Coordi...
)

Get up vector at the provided input key value

Public function Const

FVector

 

GetUpVectorAtSplinePoint

(
    int32 PointIndex,
    ESplineCoordinateSpace::Type Coordi...
)

Get the up vector at spline point

Public function Const

FVector

 

GetUpVectorAtTime

(
    float Time,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the spline's up vector there.

Public function Const

FVector

 

GetVectorPropertyAtSplineInputKey

(
    float InKey,
    FName PropertyName
)

Get a metadata property vector value along the spline at spline input key

Public function Const

FVector

 

GetVectorPropertyAtSplinePoint

(
    int32 Index,
    FName PropertyName
)

Get a metadata property vector value along the spline at spline point

Public function Const

FVector

 

GetWorldDirectionAtDistanceAlongSpline

(
    float Distance
)

Given a distance along the length of this spline, return a unit direction vector of the spline tangent there, in world space.

Public function Const

FVector

 

GetWorldDirectionAtTime

(
    float Time,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return a unit direction vector of the spline tangent there.

Public function Const

FVector

 

GetWorldLocationAtDistanceAlongSpline

(
    float Distance
)

Given a distance along the length of this spline, return the point in world space where this puts you

Public function Const

FVector

 

GetWorldLocationAtSplinePoint

(
    int32 PointIndex
)

Get the world location at spline point

Public function Const

FVector

 

GetWorldLocationAtTime

(
    float Time,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return the point in space where this puts you

Public function Const

FRotator

 

GetWorldRotationAtDistanceAlongSpline

(
    float Distance
)

Given a distance along the length of this spline, return a rotation corresponding to the spline's rotation there, in world space.

Public function Const

FRotator

 

GetWorldRotationAtTime

(
    float Time,
    bool bUseConstantVelocity
)

Given a time from 0 to the spline duration, return a rotation corresponding to the spline's position and direction there.

Public function Const

FVector

 

GetWorldTangentAtDistanceAlongSpline

(
    float Distance
)

Given a distance along the length of this spline, return the tangent vector of the spline there, in world space.

Public function Const

bool

 

IsClosedLoop()

Check whether the spline is a closed loop or not

Public function

void

 

RemoveSplinePoint

(
    int32 Index,
    bool bUpdateSpline
)

Removes point at specified index from the spline

Public function

void

 

SetClosedLoop

(
    bool bInClosedLoop,
    bool bUpdateSpline
)

Specify whether the spline is a closed loop or not.

Public function

void

 

SetClosedLoopAtPosition

(
    bool bInClosedLoop,
    float Key,
    bool bUpdateSpline
)

Specify whether the spline is a closed loop or not, and if so, the input key corresponding to the loop point

Public function

void

 

SetDefaultUpVector

(
    const FVector& UpVector,
    ESplineCoordinateSpace::Type Coordi...
)

Sets the default up vector used by this spline

Public function

void

 

SetDrawDebug

(
    bool bShow
)

Specify whether this spline should be rendered when the Editor/Game spline show flag is set

Public function

void

 

SetLocationAtSplinePoint

(
    int32 PointIndex,
    const FVector& InLocation,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Move an existing point to a new location

Public function

void

 

SetSelectedSplineSegmentColor

(
    const FLinearColor& SegmentColor
)

Specify selected spline component segment color in the editor

Public function

void

 

SetSplineLocalPoints

(
    const TArray< FVector >& Points
)

Sets the spline to an array of local space points

Public function

void

 

SetSplinePoints

(
    const TArray< FVector >& Points,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Sets the spline to an array of points

Public function

void

 

SetSplinePointType

(
    int32 PointIndex,
    ESplinePointType::Type Type,
    bool bUpdateSpline
)

Specify the type of a spline point

Public function

void

 

SetSplineWorldPoints

(
    const TArray< FVector >& Points
)

Sets the spline to an array of world space points

Public function

void

 

SetTangentAtSplinePoint

(
    int32 PointIndex,
    const FVector& InTangent,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Specify the tangent at a given spline point

Public function

void

 

SetTangentsAtSplinePoint

(
    int32 PointIndex,
    const FVector& InArriveTangent,
    const FVector& InLeaveTangent,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Specify the tangents at a given spline point

Public function

void

 

SetUnselectedSplineSegmentColor

(
    const FLinearColor& SegmentColor
)

Specify unselected spline component segment color in the editor

Public function

void

 

SetUpVectorAtSplinePoint

(
    int32 PointIndex,
    const FVector& InUpVector,
    ESplineCoordinateSpace::Type Coordi...,
    bool bUpdateSpline
)

Specify the up vector at a given spline point

Public function

void

 

SetWorldLocationAtSplinePoint

(
    int32 PointIndex,
    const FVector& InLocation
)

Move an existing point to a new world location

Public function

void

 

UpdateSpline()

Update the spline tangents and SplineReparamTable

Overridden from UPrimitiveComponent

Name Description

Public function Virtual

FPrimitiveSc...

 

CreateSceneProxy()

Creates a proxy to represent the primitive to the scene manager in the rendering thread.

Overridden from USceneComponent

Name Description

Public function Virtual Const

FBoxSphereBo...

 

CalcBounds

(
    const FTransform& LocalToWorld
)

Calculate the bounds of the component. Default behavior is a bounding box/sphere of zero size.

Overridden from UActorComponent

Name Description

Public function Virtual Const

TStructOnSco...

 

GetComponentInstanceData()

Called before we throw away components during RerunConstructionScripts, to cache any data we wish to persist across that operation

Overridden from UObject

Name Description

Public function Virtual

void

 

PostEditChangeChainProperty

(
    FPropertyChangedChainEvent& Proper...
)

This alternate version of PostEditChange is called when properties inside structs are modified.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Constants

Name

Description

DummyPointPosition

The dummy value used for queries when there are no point in a spline

DummyPointRotation

DummyPointScale

Deprecated Variables

Name Description

Public variable

bool

 

bAllowSplineEditingPerInstance_DEPRECATED

Public variable

FInterpCurveVec...

 

SplineInfo_DEPRECATED

Deprecated - please use GetSplinePointsPosition() to fetch this FInterpCurve

Public variable

FInterpCurveFlo...

 

SplineReparamTable_DEPRECATED

Public variable

FInterpCurveQua...

 

SplineRotInfo_DEPRECATED

Deprecated - please use GetSplinePointsRotation() to fetch this FInterpCurve

Public variable

FInterpCurveVec...

 

SplineScaleInfo_DEPRECATED

Deprecated - please use GetSplinePointsScale() to fetch this FInterpCurve

See Also

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss