RealDocs

AAIController::GetFocalPointOnActor

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

Description

Returns the world-space point on the given actor that the controller should look at. Override this to customize the aim point (e.g., aiming at a character's chest instead of the actor origin).

Caveats & Gotchas

  • The default implementation returns the actor's GetActorEyesViewPoint position, which for Pawns is typically the eye socket — not the root component origin. Subclasses that need a different bone or socket must override this explicitly.
  • Passing a null Actor pointer results in FAISystem::InvalidLocation being returned; callers should guard against null if the actor reference may be stale.

Signature

virtual FVector GetFocalPointOnActor(const AActor *Actor) const

Parameters

Name Type Description Default
Actor const AActor* The actor whose representative focal position is returned.

Return Type

FVector

Example

Override to aim at a specific skeletal socket C++
FVector AMyAIController::GetFocalPointOnActor(const AActor* Actor) const
{
	const ACharacter* Char = Cast<ACharacter>(Actor);
	if (Char && Char->GetMesh())
	{
		return Char->GetMesh()->GetSocketLocation(TEXT("spine_03"));
	}
	return Super::GetFocalPointOnActor(Actor);
}

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.