Download

How to find the Actor to which another Actor is attached to

I have two Blueprints.

BP_Ship (extended from Pawn) ( [ROOT]SphereComponent -> StaticMeshComponent -> Camera)
BP_Dummy (extended from Actor). ( [ROOT]SphereComponent -> StaticMeshComponent)

When the Ship hits the Dummy, I use ‘Attach Actor to Actor’ and attach the Dummy TO Ship. It attaches correctly and now the Dummy moves along with my Ship.

But I have some logic inside the BP_Dummy blueprint which will need a reference to the Actor it is attached to (an instance of BP_Ship). I tried calling ‘Get Owner’ and passing the output of ‘Get Root Component’ into it. But the problem is even after the attachment it returns a reference to BP_Dummy (instead of BP_Ship).

So how do I achieve what I want?

We should probably have GetAttachParentActor() exposed to blueprints. However, you can probably get what you want by doing GetRootComponent -> GetAttachParent -> GetOwner.

I did not use GetAttachParent in between.

Thanks!