RealDocs

APawn::GetActorEyesViewPoint

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverrideconst

Description

Returns the world-space location and rotation of the pawn's eye point, used by the engine for line-of-sight checks, AI perception, and camera queries. By default, the location is the actor location offset upward by BaseEyeHeight, and the rotation is GetViewRotation().

Caveats & Gotchas

  • This is called frequently by AI perception and sight checks — avoid expensive work in overrides. The default implementation does not account for crouching or custom skeletal socket positions; ACharacter overrides this for crouch support.
  • For AI sight tests the engine calls this on both the perceiver and the target, so an incorrect override can silently break all sight-based AI for pawns using that class.

Signature

virtual void GetActorEyesViewPoint( FVector& Location, FRotator& Rotation ) const override

Parameters

Name Type Description Default
Location FVector& Output: the world-space position of the pawn's eyes.
Rotation FRotator& Output: the rotation representing the eye's view direction.

Return Type

void

Example

Override to use a socket as the eye position C++
void AMyPawn::GetActorEyesViewPoint(FVector& Location, FRotator& Rotation) const
{
	if (USkeletalMeshComponent* Mesh = GetMesh())
	{
		Location = Mesh->GetSocketLocation(TEXT("EyeSocket"));
		Rotation = GetViewRotation();
		return;
	}
	Super::GetActorEyesViewPoint(Location, Rotation);
}

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.