RealDocs

AAIController::FindPathForMoveRequest

function AIModule Since 4.13
#include "AIController.h"
Access: public Specifiers: virtual

Description

Executes pathfinding for a move request and stores the resulting path. Override this to modify the query before it is submitted or to post-process the generated path.

Caveats & Gotchas

  • This replaced the deprecated PreparePathfinding and RequestPathAndMove pair in UE 4.13. If you have old code using those functions, migrate to BuildPathfindingQuery + FindPathForMoveRequest.
  • Runs synchronously — if async pathfinding is needed, the NavigationSystem handles that separately; OutPath may still be valid but incomplete until the async result arrives.
  • The Query parameter is passed by non-const reference intentionally — you can safely append cost modifiers or change the filter inside your override before calling Super.

Signature

virtual void FindPathForMoveRequest(const FAIMoveRequest& MoveRequest, FPathFindingQuery& Query, FNavPathSharedPtr& OutPath) const

Parameters

Name Type Description Default
MoveRequest const FAIMoveRequest& The move request containing goal and filter information.
Query FPathFindingQuery& Pre-built pathfinding query (from BuildPathfindingQuery). Modify here before it is submitted to the navigation system.
OutPath FNavPathSharedPtr& Output path produced by the navigation system.

Return Type

void

Example

Override to inject a custom query cost modifier C++
void AMyAIController::FindPathForMoveRequest(
	const FAIMoveRequest& MoveRequest,
	FPathFindingQuery& Query,
	FNavPathSharedPtr& OutPath) const
{
	// Modify query before pathfinding runs
	Query.NavDataFlags |= MyCustomFlag;
	Super::FindPathForMoveRequest(MoveRequest, Query, OutPath);
	// Post-process path here if needed
}

Version History

Introduced in: 4.13

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.