How to set the AI perception "eyes" location?

It is fairly easy to change the location that the AI perception uses as the source of the sight sense in C++. You need a custom character class and then override GetActorEyesViewPoint.
I often use a custom socket that I can add or move on any character and set that as the location:

In the cpp file:

void ABase_Game_Character::GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const
{
	Location = GetMesh()->GetSocketLocation("AI_EYES");
	Rotation = GetMesh()->GetSocketRotation("AI_EYES");
}

and in the header:

	//Override for AI Perception "Eye" Location
	void GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const override;

See this post for more details:

3 Likes