RealDocs

AAIController::GetFocalPoint

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

Description

Returns the world-space position the controller is currently focused on, resolved across all priority levels. This is the position the pawn will rotate toward during UpdateControlRotation.

Caveats & Gotchas

  • Returns the highest-priority valid focal point. If a focus actor is set, the point is derived from the actor's location at call time, not cached — so the returned value changes each frame as the actor moves.
  • If no focus has been set at any priority, the returned vector may be FAISystem::InvalidLocation (a very large sentinel value). Always validate with FAISystem::IsValidLocation before using the result in math.

Signature

FVector GetFocalPoint() const

Return Type

FVector

Example

Check if pawn is roughly facing its focus C++
FVector FocalPt = GetFocalPoint();
if (!FAISystem::IsValidLocation(FocalPt))
{
	return; // no focus set
}
FVector ToFocus = (FocalPt - GetPawn()->GetActorLocation()).GetSafeNormal();
float Dot = FVector::DotProduct(GetPawn()->GetActorForwardVector(), ToFocus);
bool bFacing = Dot > 0.95f;

Tags

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.