0
\$\begingroup\$

I'm trying to stick some blocks together, but frankly I have no idea what I'm doing. I spawn 2 blocks during run time, and if they have an on hit event they're supposed to stick to each other.

It struck me that I'm not even sure if that's what attach does, and maybe it has some completely different meaning.

with the following blueprints, I'm getting all sorts of errors like "already attached" and "can't attach actor to actor, already attached"

https://imgur.com/a/16Zz2eS

Any help appreciated

\$\endgroup\$
1
\$\begingroup\$

It really depends on your use case.

For example can any cube stick to any cube?
Or maybe a number of cubes can only stick to some others etc...

Regarding the error messages:

I guess both of your Blueprints are triggering your attachment functionality, and that is why you getting the errors. You have to find a way to trigger it only once per collision.

You can use the Get Attached Actors node to get a list of all the attached Actors of an Actor, or any similar node that fits your use case.

Then you can iterate though it and check if you are already attached to that Actor.

Keep in mind I have not tested this working, and this might not be a very good solution if you have a large number of colliding objects in a short period of time.

But could be a good starting point.

\$\endgroup\$
2
  • \$\begingroup\$ Hm, you make a lot of good points. For the moment, any cube can stick to any cube - all I'm really doing is trying to test functionality, as right now I really don't have anything working at all. I'll look at limiting attachments later. Can I take it that attachActor does actually stick things together, and isn't something unrelated? for my application, the objects getting stuck together should happen no more than 1 or 2 per second so it shouldn't be an issue \$\endgroup\$
    – Mauvai
    Sep 24 '20 at 16:16
  • \$\begingroup\$ I Think i was right earlier... it seems attach is attaching it to the hierarchy, not welding the blocks togther \$\endgroup\$
    – Mauvai
    Sep 24 '20 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.