Get Relative Location for actor

I have one actor that spawns other actor(s) as its child (body spawns hand for instance). Now I need to place that hand with relative location to body (which works), but when I am in blueprint of a hand, I cannot get relative location even though I can set it (and it works as it should/I expect it to). What am I doing wrong?

1 Like

It just looks like there is no Get Relative Location node, but there is a Get Relative Transform, which has the information you need, you just need to break it down:

You could just create your own Get Relative Location Macro that outputs only the location to keep things tidy.

2 Likes

Thank you kindly, that is very helpful and I can’t believe that I’ve missed that.

This is a solution for getting relative transform when attaching an Actor to another Actor:

2 Likes

Note that all the relative transforms and locations using default Unreal functions such as GetActorLocation(when it is attached to another actor), RootComponent->RelativeLocation and GetRelativeTransform on the SceneComponent are in local space of the parent component/actor.

It’s important to remember what you’re getting when you’re working with those relative transforms. I needed world relative location and the only way I found how to do it is to just write it myself:

1 Like

For anyone still wondering


AActor doesn’t implement the method GetRelativeTransform since it doesn’t inherit from USceneComponent, however you can always call it from the RootComponent, it works exactly the same way as any other scene comp