The Spline Component provides users with a way to draw splines within a level. This is particularly useful for designating paths for moving Actors, such as trains, background characters, or cameras. When placed in a level, an Actor with a Spline Component will show a point at the component's location with a line connecting it to a second point a short distance away. The line can be right-clicked to add a new point at the location of the click, while the point can be clicked to remove it (unless it is the only point), duplicate it, or change the curve leading from it to the next point in the spline. Using duplication will create a new point that sits at the same location as the current point, but is considered to be "after" it in the line. Spline points can be freely manipulated within the level using standard movement and rotation tools. There is also a field labeled
Duration located in the component's Details panel, which acts as a range value for querying the spline.
There are three primary ways to query the spline:
By point index, where the spline can be asked for information like the location and rotation of any of the user-placed points along its length.
By distance, where the spline can be asked for information such as the rotation forward vector of the spline after traveling a set distance along it.
With "time", where the spline's length is replaced by a user-entered
Duration value and can be queried for distance, location, and rotation information about the spline at a given "time" value. This third method is especially useful in the case of fixed objects like cameras moving along a track defined by a spline, since the designer or programmer can simply ask for the camera's location and rotation based on how long the camera has been moving along the spline.
It is also easy to interpolate or blend along a spline by setting the duration to 1.0 and then providing an interpolation "alpha" value.
In the following image, the spline component could be used to move a "hint" marker, showing the player where to go.
Splines created by a Spline Component will never fork into multiple paths or contain loops or orphaned points. Splines are always single paths that contain each spline point exactly once.