Back to search
PatternGold tierAI

AI patrol between waypoints using NavMesh

Updated 3mo ago
UE 5.3UE 5.4UE 5.5UE 5.6UE 5.7#ai#patrol#waypoints#navmesh#loop#move

Reference

Variables: WaypointLocations (Array<Vector>), CurrentWaypointIndex (int). Pattern: EventBeginPlay → set up WaypointLocations array → MoveToNextWaypoint (custom event). MoveToNextWaypoint: GetController → CastTo<AIController> → MoveToLocation(Dest=WaypointLocations[CurrentWaypointIndex], AcceptanceRadius=100) → Bind OnMoveCompleted delegate → In callback: Increment CurrentWaypointIndex (modulo array length) → call MoveToNextWaypoint again. Alternative: Use SimpleMoveToLocation for simpler cases. Requires NavMeshBoundsVolume in scene. GetRandomReachablePointInRadius for random wander.