GetTransform() vs. GetActorTransform()

The difference between these two methods is pretty vague. The values returned seem to be the same in the debugger, and yet the source seems to have some varying intent. The documentation is also kinda sparse with:

GetTransform
Get the actor-to-world transform.
The transform that transforms from actor space to world space.

and…

GetActorTransform
Returns the transform of the RootComponent of this Actor

So, assuming that for a given actor, it’s final position is determined based on a transform that is applied relative to world space against its root component, then I’m confused about the difference. GetTransform() uses RootComponent->GetComponentTransform(), while GetActorTransform() also uses another function (TemplateGetActorTransform(…)) that calls the same method. GetTransform falls back to FTransform::Identity, while GetActorTransform() falls back to returning a default FTransform() instance.

Uhh… so they seem almost identical, with some slightly different semantic meaning that’s very unclear. The best I can determine is that GetTransform() is decorated with a UFUNCTION(…) macro that exposes it to the editor, whereas GetActorTransform() does not (and is an inlined function)…

Cheers!

  • Sean
4 Likes

Privacy & Terms