Player damaging Self?

Hello!

I am having a bit of an issue, I have set up melee collision so that a player of one type can deal damage to a player using the same type of character, but if I stand in place and attack my player kills itself because it collides with itself. How can I change the system so it ignores my player and only hits enemy targets?

Thank you.

basically you need to add your character to the ignore array of the weapon’s collision. seems not to work as expected in blueprints tho, i’m in a same problem and by now i workaround by setting the weapons and characters in different layers + set each actor class (player/weapon) to ignore the other’s layer. like that you at least can walk with the weapon around…

I might recommend using a raycast instead, with the raycast having “self” added to its ignore list. It’s a little bit more easier to work with and is less prone to strangeness having tried both box collision and raycast methods. The way I did it for a sword was to set the start to the location of the swords socket/handle and the end point to be the swords socket location + (forward direction*200, 200 being the length in units of the sword’s blade) For axes you could just do multiple raycasts from different locations, and use the preview raycast option to see that its casting the overall shape of the blade accurately enough.

My 2 cents anyways.

Add a branch next to “OnComponentBeginOverlap” and check if “OtherActor” equals Player Pawn.

keep in mind that this option adds a bit of load on performance, because the overlap events still occur.
a better way would be setting the overlaps to be ignored.

it helped a lot, thank you

269412-imgggg.png

1 Like