x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text

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. alt text

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!

Product Version: UE 4.15
Tags:
correcttimeline.png (525.6 kB)
wrongtimeline.png (527.9 kB)
more ▼

asked Nov 02 '17 at 09:48 AM in C++ Programming

avatar image

ogermann
6 1 2 3

avatar image Maverick_tango Aug 31 '18 at 09:11 AM

@ogermann how you got this hierarchy ??

alt text

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

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Nov 17 '17 at 06:41 PM

avatar image

Suradner
1 2

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question