I have a character that throws punches.
I added a collision capsule attached to the character’s hand and, when he attacks, this capsule checks for overlaps and applies damage if it overlaps an enemy. I’m using Unreal’s “Apply damage” and “Apply point Dagame” prebuilt nodes.
It’s working as expected and the punches are doing damage to the enemies.
Now I would like to make so that if the character punches a wall or rock, or anything that isn’t an enemy or a destructible item, the punch animation stops and another animation plays (an animation of his hand bouncing back, making clear that whatever he has hit is too hard and didn’t take damage).
But I’m having trouble finding a way to do that. I don’t want to have to check against every type of ‘punchable’ actor in the game.
Also sometimes enemies are invincible and I would like the punch to stop when hitting an invincible enemy too, so even checking if the other actor is an enemy is not enough.
What I wanted is something that returns a bool that confirms that this punch was “successful” or not (in other words, that whatever was punched took damage or not), but I don’t know how to do that.