Navigation
Unreal Engine C++ API Reference > Runtime > Engine > GameFramework > AActor
References
Module | Engine |
Header | /Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h |
Include | #include "GameFramework/Actor.h" |
FVector GetActorLocation&40;&41; const
Remarks
Returns the location of the RootComponent of this Actor
Example Code
ShooterProjectile.cpp at line 145:
void AShooterProjectile::OnRep_Exploded()
{
FVector ProjDirection = GetActorForwardVector();
const FVector StartTrace = GetActorLocation() - ProjDirection 200;
const FVector EndTrace = GetActorLocation() + ProjDirection 150;
FHitResult Impact;
if (!GetWorld()->LineTraceSingleByChannel(Impact, StartTrace, EndTrace, COLLISION_PROJECTILE, FCollisionQueryParams(SCENE_QUERY_STAT(ProjClient), true, GetInstigator())))
{
// failsafe
Impact.ImpactPoint = GetActorLocation();
Impact.ImpactNormal = -ProjDirection;
}
Explode(Impact);
}