AActor::GetActorLocation
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Returns the current world-space location of the actor's root component. This is equivalent to `GetRootComponent()->GetComponentLocation()` if a root component exists.
Signature
FVector GetActorLocation() const Return Type
FVector Caveats & Gotchas
- • Returns FVector::ZeroVector if there is no root component.
- • For actors that are frequently queried, cache the result rather than calling repeatedly within the same frame — each call goes through the transform hierarchy.
- • To get the actor's local-space pivot offset, use GetActorRelativeLocation() instead; GetActorLocation() always returns world space.
Example
Getting actor location C++
FVector Loc = SomeActor->GetActorLocation();
UE_LOG(LogTemp, Log, TEXT("Actor is at %s"), *Loc.ToString()); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?