Announcement

Collapse
No announcement yet.

Ignore Sphere Collision

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

    Ignore Sphere Collision

    I thought it'd be easy to disable collision FOR a specific actor, but I was kinda wrong after 6 hours of labor.

    My character does a melee attack in first person by spawning a spherical trigger actor in front of them. While the move last, the sphere is always kept in the sights of the player. Now, because of the size of the sphere, it has to overlap the player's collision, thus the player is taking damage from himself.

    Now, I don't want to get into too many details because this is a multiplayer game we're talking about and don't wanna get you guys too warped in my crazy network methods, but just know that the most simplest way to solve this issue is to somehow have the sphere ignore the player that spawned it. I already used the GetInstigator Node to get the player to ignore the sphere using Ignore Actor When Moving, which works...except when moving.

    Is there some way to just ignore the collision of a specific actor, FOR a specific actor using BP? Thanks for any help!

    #2
    If you add/spawn a sphere collision component INSIDE of the character, instead of spawning another actor, self-collision should be ignored. You could also (though probably not sufficient for a melee attack) use a sphere trace.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    Comment


      #3
      You could also cast to the sphere and check self collision that way. Sphere would have a custom event called by the player at spawn (rather than the sphere firing a beginplay event), the custom event can have an actor input, plug a self reference into that input.

      Comment


        #4
        Originally posted by NotSoAccurateNo1 View Post
        You could also cast to the sphere and check self collision that way. Sphere would have a custom event called by the player at spawn (rather than the sphere firing a beginplay event), the custom event can have an actor input, plug a self reference into that input.
        So exactly how would casting from the player to sphere be different from casting sphere to player? In what way can I say "ignore the player that spawned you" from the player that I couldn't do by getting the parent or the instigator from the sphere?

        Comment


          #5
          So here's a different way to look at the issue. What I have now is that in every player, it spawns the sphere actor on the server and the actor replicates. What if there is a way to have it spawn, but none of the players will have the actor spawned on their side/client side. I turned off the replicate on the actor but it still does self damage. Here's what I have so far:

          Attached Files

          Comment


            #6
            Sometimes working backwards sets certain events to fire in a more appropriate order, but I digress.

            ---

            Ignoring what I said before, what's the current method of getting overlapping actors, is it a built-in onOverlap event or is it a getAllOverlapping node? It needs to be getAllOverlapping into a forEachLoop to parse the actors to be able to check for the owning actor.

            Comment


              #7
              Originally posted by NotSoAccurateNo1 View Post
              Sometimes working backwards sets certain events to fire in a more appropriate order, but I digress.

              ---

              Ignoring what I said before, what's the current method of getting overlapping actors, is it a built-in onOverlap event or is it a getAllOverlapping node? It needs to be getAllOverlapping into a forEachLoop to parse the actors to be able to check for the owning actor.
              Sorry for the late reply, I needed a break from the project a bit. But here's how the detection is happeneing, simple OnBeginOverlap that cast to all types then sends damage.

              Attached Files

              Comment


                #8
                This is all I was able to come up with, it doesn't work, the player is still able to hurt himself but only after a few hard tries; I don't know what else to do to solve this, it seems easier than it looks but it's quite annoying >
                Attached Files

                Comment


                  #9
                  Right you need to add a "equals" node into a "branch" node after the "foreachloop" to check the overlapped actor. Also add a new variable of type "actor" to the sphere. In the player blueprint, when the player spawns the sphere, cast to the sphere and set the actor variable in the sphere to be "self". In the sphere blueprint, the "equals" node checks overlapping actor with the actor variable and, if true, do nothing, if false do damage.

                  That "getoverlappingactors" node should target self (just unhook the blue wire) not the actor it is actually overlapping or you'll get a different array of actors. It should also run off of begin play and not oncomponentoverlap because you'll potentially fire the event multiple times.
                  You can add more exec wires to begin play by using a "sequence" node.
                  Last edited by NotSoAccurateNo1; 03-27-2019, 12:55 PM.

                  Comment


                    #10
                    Originally posted by NotSoAccurateNo1 View Post
                    Right you need to add a "equals" node into a "branch" node after the "foreachloop" to check the overlapped actor. Also add a new variable of type "actor" to the sphere. In the player blueprint, when the player spawns the sphere, cast to the sphere and set the actor variable in the sphere to be "self". In the sphere blueprint, the "equals" node checks overlapping actor with the actor variable and, if true, do nothing, if false do damage.

                    That "getoverlappingactors" node should target self (just unhook the blue wire) not the actor it is actually overlapping or you'll get a different array of actors. It should also run off of begin play and not oncomponentoverlap because you'll potentially fire the event multiple times.
                    You can add more exec wires to begin play by using a "sequence" node.
                    I tried it but it didn't quite work, just gave errors concerning the for loop. Also tried this logic in begin play and nothing changed. So is it not supposed to be fired from the Overlap event? I ask because the move last for about a second and a half and there can be a situation when a player can enter in the attack during. Would begin play work still to accommodate that?
                    Attached Files
                    Last edited by cooper37; 03-27-2019, 10:19 PM.

                    Comment

                    Working...
                    X