AttachToActor() with its RootComponent

Hallo Community.

I try to attach multiple blocks to one building with the help of AttachToActor.
This works fine as long as I observe the correct order.

In the Pictures below the “Round” components (red text) will attach all overlapping objects (blue text) after t seconds to the lowest Actor, and then destroying itself.

When I do this step by step in the correct order as shown above a perfect chain will be created. (Small Image above right)

But when I now start attaching from left and right side simultaneously (as shown in the picture below) two object chains will be created instead of one.
In my opinion the last attachment failed.

What can I do to “Combine” both Chains?

A part of the Attaching Act:

    AStoneBrick* BasicStone = overlappingStones[0];
    for(AStoneBrick* A:overlappingStones){
        if(BasicObject != A){
           A->AttachToActor(BasicObject,FAttachmentTransformRules(EAttachmentRule::KeepWorld, true));
         }
 }

Thank you very much for your answer!

I’m just starting out, so my apologies if I say something incorrect, but my understanding is that an actor or component can only be attached to one thing at a time, because it’s not a two-way relationship but instead a strict hierarchy where one wholly dictates unto the other.

In the second example, it looks like things are going about how you want them to right up until t=6 triggers. At that point, the actor does literally and specifically what you told it to and attaches Stone 15 to Stone 11, replacing its previous attachment to Stone 13 in the process and thereby “stealing” it away. It doesn’t know or care about whatever attachment chain Stone 15 might previously have been a part of.

To fix this, you could either pay special attention to your sequencing, or else you could amend the “round” components’ code to check for an attached parent and, if one is found, go “up the chain” until it finds the topmost actor and attach that instead.

@ogermann how you got this hierarchy ??

252157-218779-wrongtimeline.png

Did you use C++ classes for this or blueprint ???