Skip to main content

Objective Waypoint System (C++ Plugin)

Blueprint only Project​

Waypoint component is the main component of this plugin which you have to add to your player character or pawn. To add the component, select it from Components tab.

Component screenshot

C++ Project​

For C++ users, you have to first add plugin dependency in your Build.cs file like below:

PrivateDependencyModuleNames.AddRange(new string[] { "ObjectiveWaypointSystem" });

Then in your character or pawn header file, add the component. Here is an example:


class UWaypointComponent;

UCLASS()
class YOURPROJECTNAME_API AYourCharacter : public ACharacter
{
GENERATED_BODY()

protected:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
TObjectPtr<UWaypointComponent> WaypointComponent;

public:

AYourCharacter();
};

Then in your source file (.cpp) create your constructor and add the following.

#include "WaypointComponent.h"

AYourCharacter::AYourCharacter()
{
WaypointComponent = CreateDefaultSubobject<UWaypointComponent>(TEXT("WaypointComponent"));
}

Component settings​

After adding the component, you can adjust it's settings from the details panel.

NameDescription
Filter By ClassFind path on selected navigation class only.
Waypoint Actor ClassWhich waypoint actor class to spawn. You can inherit from Waypoint Actor and customize it to suit your needs.
Tick TimeIf greater than 0, path finding is automatically called every N second.
Navigation ModeType of waypoint to show. Options are Spawn and Spline
Max number of meshesNumber of meshes to spawn. If 0, max meshes are clamped to 255. Only applicable if Nav Mode is set to Spawn.
Auto calculate mesh distanceAutomatically calculates distance between meshes based on bounds. Only applicable if Nav Mode is set to Spawn.
Mesh DistanceDistance between spawned waypoint meshes. Only applicable if Nav Mode is set to and Auto calculate mesh distance is disabled.
Spline MeshMesh to use when Nav Mode is set to Spline mode.
Spline Mesh ScaleScale of spline mesh. Only applicable if Nav Mode is set to Spawn.

After setting up the component it is upto your game logic on finding the target actor or location to find the path to. Once you have acquired it, simply pass that information to Find Path to Actor or Find Path to Location functions and you are good to go.

Below is an example function.

Function screenshot