AActor::GetActorEyesViewPoint
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualconst
Description
Returns the world-space location and rotation representing this actor's eye position and view direction. Used by weapon traces, AI perception, and camera systems to determine where the actor 'sees' from.
Caveats & Gotchas
- • The base AActor implementation returns GetActorLocation() and GetActorRotation(). For pawns, APawn overrides this to apply the eye height offset — always use this virtual rather than reading location directly for trace-from-eyes logic.
- • The rotation returned is the full view rotation (including pitch), unlike GetActorRotation() on a pawn which zeros out pitch; confusing these is a common source of incorrect weapon trace directions.
Signature
ENGINE_API virtual void GetActorEyesViewPoint( FVector& OutLocation, FRotator& OutRotation ) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| OutLocation | FVector& | Filled with the world-space eye location of this actor. | — |
| OutRotation | FRotator& | Filled with the view rotation at the eye location. | — |
Return Type
void Example
Fire a trace from the actor's eye point C++
FVector EyeLocation;
FRotator EyeRotation;
GetActorEyesViewPoint(EyeLocation, EyeRotation);
FVector TraceEnd = EyeLocation + EyeRotation.Vector() * 5000.f;
FHitResult Hit;
GetWorld()->LineTraceSingleByChannel(Hit, EyeLocation, TraceEnd, ECC_Visibility); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?