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.
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.
Name | Description |
---|---|
Filter By Class | Find path on selected navigation class only. |
Waypoint Actor Class | Which waypoint actor class to spawn. You can inherit from Waypoint Actor and customize it to suit your needs. |
Tick Time | If greater than 0, path finding is automatically called every N second. |
Navigation Mode | Type of waypoint to show. Options are Spawn and Spline |
Max number of meshes | Number of meshes to spawn. If 0, max meshes are clamped to 255. Only applicable if Nav Mode is set to Spawn. |
Auto calculate mesh distance | Automatically calculates distance between meshes based on bounds. Only applicable if Nav Mode is set to Spawn. |
Mesh Distance | Distance between spawned waypoint meshes. Only applicable if Nav Mode is set to and Auto calculate mesh distance is disabled. |
Spline Mesh | Mesh to use when Nav Mode is set to Spline mode. |
Spline Mesh Scale | Scale 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.