The most basic AI-controlled follow behavior is available as a simple function node. All you have to do is perform the steps that follow to get one AI-controlled unit to follow a unit or object.
Have a UE4 project ready with a simple landscape or set of geometry on the ground— ideally, with a cul-de-sac somewhere in the geometry for testing out AI movement functions. Create a Nav Mesh over this geometry so that the AIMoveTo
function will work as described in the previous recipe.
Character
by finding the Character
class in the Class Viewer, right-clicking on it, and selecting Create Blueprint Class…BP_Follower
.BP_Follower
class to edit its Blueprint.Tick
event, add an AIMoveTo
node, which moves towards the player pawn (or any other unit) as follows:The AIMoveTo
node will automatically use a Nav Mesh if one is available. If a Nav Mesh is not available, then the NPC unit won't move.
13.59.154.190