RealDocs

AAIController::OnMoveCompleted

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

Description

Called by the engine when the current movement request finishes, is aborted, or is blocked. Override to react to movement outcomes in C++.

Caveats & Gotchas

  • Both a C++ virtual (OnMoveCompleted) and a Blueprint-assignable delegate (ReceiveMoveCompleted) exist. Binding ReceiveMoveCompleted does not prevent OnMoveCompleted from firing — both are called independently.
  • The old overload accepting EPathFollowingResult::Type (not FPathFollowingResult) is deprecated since 4.13. The new overload receives a struct with additional flags including whether the path was partial.
  • Always call Super::OnMoveCompleted if you override it. The base class forwards the event to ReceiveMoveCompleted and updates internal tracking state.

Signature

virtual void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& Result)

Parameters

Name Type Description Default
RequestID FAIRequestID Identifier of the move request that finished. Compare against a stored request ID to filter relevant completions.
Result const FPathFollowingResult& Detailed result including the EPathFollowingResult enum and flags describing how the move ended.

Return Type

void

Example

Override to start a new patrol move on completion C++
void AMyAIController::OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& Result)
{
	Super::OnMoveCompleted(RequestID, Result);

	if (Result.IsSuccess())
	{
		// Reached destination, move to next patrol point
		MoveToNextPatrolPoint();
	}
	else if (Result.HasFlag(FPathFollowingResultFlags::Blocked))
	{
		UE_LOG(LogAI, Warning, TEXT("Move was blocked!"));
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.