Announcement

Collapse
No announcement yet.

AttachTo would form cycle?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    AttachTo would form cycle?

    Hello there everyone!
    I'm Mofoman22 first post here

    Let's get right into it:
    I created a BP_BaseGrenade to have different grenades in my game, as the semtex one, which is the problematic one.
    Click image for larger version

Name:	4bcfb652d278d5ff5c083da422b22432.png
Views:	1
Size:	165.9 KB
ID:	1192852

    You can see in the execution path highlighted with those handmade fancy red arrows what i made, basically AttachToActor, setting the physics off and disabling the collision.

    It is working nice but it is giving me a warning when i spawn multiple actors sometimes (something that i couldnt figure out why it is happening)
    Basically this is the warning message:
    • Warning AttachTo: 'BP_StickyGrenade_C_3.StaticMesh' alredy attached to 'BP_StickyGrenade_C_1.StaticMesh' would form cycle. Aborting.


    Any idea about how can i avoid that warning? Thank you all!

    #2
    Hey MofoMan22,

    I think that what you are seeing is two of your grenades trying to attach to each other:
    -Grenade 1 receives OnComponentHit event and attaches to grenade 2
    -at the same time, Grenade 2 receives OnComponentHit event and tries to attach to grenade 1

    The second grenade though can't really attach to the first one since each object would be attached to each other "forming a cycle".

    I am not sure if you'd like your grenades to be able to attach to each other - (if not) I would suggest adding another branch checking if the HitActor is of "StickyGrenade" class
    Check my User Interface Kit here: https://forums.unrealengine.com/show...-Interface-Kit
    A WIP Hex Planet Generation: https://forums.unrealengine.com/show...ral-Generation

    Comment


      #3
      Originally posted by Semitable View Post
      I would suggest adding another branch checking if the HitActor is of "StickyGrenade" class
      Thanks for the response Semitable
      Wont this make me to check with branching every single sticky element i have with EventHit?
      Still thinking about another posible solution that will avoid using multiple branching, anyways thanks for your help!

      Comment


        #4
        Originally posted by Semitable View Post
        Hey MofoMan22,

        I think that what you are seeing is two of your grenades trying to attach to each other:
        -Grenade 1 receives OnComponentHit event and attaches to grenade 2
        -at the same time, Grenade 2 receives OnComponentHit event and tries to attach to grenade 1

        The second grenade though can't really attach to the first one since each object would be attached to each other "forming a cycle".

        I am not sure if you'd like your grenades to be able to attach to each other - (if not) I would suggest adding another branch checking if the HitActor is of "StickyGrenade" class
        Yeah i dont want my nades to attach haha, and any other posible solution that will avoid the multiple branching, because i have some more "sticky" elements as C4 with hit events aswell that could have the same problem :S

        Comment


          #5
          You can give your objects that you want things to stick to a tag called "Stickable" or something. and then on collision check for the tag using ActorHasTag. True = stick, false = keep on going.

          Comment


            #6
            Originally posted by HaxO View Post
            You can give your objects that you want things to stick to a tag called "Stickable" or something. and then on collision check for the tag using ActorHasTag. True = stick, false = keep on going.
            I see! It could be interesting doing it the reverse way with non-stickable elements. I'll give it a try! Thanks

            Comment


              #7
              An even better way (but a bit more difficult) would be to create a custom collision channel ( https://www.unrealengine.com/blog/collision-filtering )
              This would be a solution where you wouldn't have to branch and have that extra check..
              Check my User Interface Kit here: https://forums.unrealengine.com/show...-Interface-Kit
              A WIP Hex Planet Generation: https://forums.unrealengine.com/show...ral-Generation

              Comment

              Working...
              X