Dominik here, again, after many years and with a lot of new experience.
The only difference here is the following:
GetActorLocation is written like this:
template<class T>
static FORCEINLINE FVector TemplateGetActorLocation(const T* RootComponent)
{
return (RootComponent != nullptr) ? RootComponent->GetComponentLocation() : FVector::ZeroVector;
}
and GetActorTransform() like this:
UFUNCTION(BlueprintCallable, meta=(DisplayName = "Get Actor Transform", ScriptName = "GetActorTransform"), Category="Transformation")
const FTransform& GetTransform() const
{
return ActorToWorld();
}
/** Get the local-to-world transform of the RootComponent. Identical to GetTransform(). */
FORCEINLINE const FTransform& ActorToWorld() const
{
return (RootComponent ? RootComponent->GetComponentTransform() : FTransform::Identity);
}
In the end, both methods are returning transform data of the RootComponent, so if working if Location only, it might be a few CPU cycles cheaper to use directly GetActorLocation. However, if you were about to ask for GetActorLocation and then for GetActorRotation, it easier is to cache the GetActorTransform and then access that cached value.