Skip to main content

Path Template

Path Splines

When you create a new PathTemplate, MainPathSpline component gets created automatically (of class UEpPathSplineComponent). This is the most important component in the entire PathTemplate as it decides the length and shape of the PathTemplate.
MainPathSpline is usually a straight-line, placed along the blueprint's X axis and has only two points. For intersections it often has a different shape (ex: circle for a roundabout).

PathTemplates used as intersections need to have multiple PathSplines. New PathSplines can be added the same way as other types of components and need to be attached to the root component. PathSplines serve as attachment points for other Paths to connect to.

PathSplines can have any shape in the PathTemplate, but often use very simple shapes (such as |,X,Y,O). These shapes can later be bent, stretched or extended once the Path is spawned in the level. When one of the PathSplines is bent in the level, the meshes placed along that spline move/bend as well.

Spawning Actor Components

ActorComponents can be used to add logic to a Path (ex: traffic lights switching). In order to add ActorComponents to a Path create a blueprint deriving from APath class and add some ActorComponents to it.

Components from the APath blueprint will be spawned once per Path.

Spawning Scene Components and Static/Spline Meshes

SceneComponents and meshes are spawned as part of PathTemplates.

For meshes, there are two special classes - PathTemplateSplineMeshComponent and PathTemplateStaticMeshComponent that should be used instead of the plain StaticMeshComponent/SplineMeshComponent meshes. These classes come with extra properties that are useful in Paths (such as randomization, landscape adjustment, etc).

Spawning Splines

The plugin also supports spawning SplineComponents as part of PathTemplates. They can be used for AI, navigation or for guiding secondary, dependant Paths. Spline components from neighboring PathTemplates will be merged together if possible (if their types and start/end spline point positions match across the template borders).

Splines can be spawned in the separate actor called SplineActor. This separation can be highly beneficial when creating a large open world with GPS system while taking advantage of Unreal's streaming systems. By freely streaming a large number of Paths with expensive meshes while keeping the splines always loaded, they remain available for the navigation system.

SplineActor can be set in the Path's description or in the project settings.

Mesh Hierarchies

The curvature of the spawned spline-meshes often differs slightly from the curvature of the PathSpline. This is because spline-meshes have only two control points (start/end) along the PathSpline, while the PathSpline may have any number of spline points. Mesh start/end points may also have different tangent lengths, be rotated, etc.

As a result, two spline-meshes passing through the same point in the PathTemplate are not guaranteed to pass through the same point in the spawned Path. In order to make two meshes deform together, one of them needs to be attached/parented to the other in the component hierarchy. The child will then spawned relative to the parent.

Meshes extending beyond the bounds of a PathTemplate

Meshes are typically placed within the length of a PathTemplate (as defined by their PathSplines).

They can extend further, but are not guaranteed to match the curvature of the neighboring PathTemplate. The challenge here comes from conditional spawning - every spawned PathTemplate may be different, have a different component hierarchy and use different meshes.