Melee is simply doing damage to characters if they reside within a certain distance to the melee damage dealer.
- Weapon Collision with Components
- Capsule Overlapping Actors
in PlayerCharacter class
- With in PlayerCharacter class making character class with a Capsule component that is wide enough to "overlap" potential melee recipients.
- triggering the start of our damage method via an input
- getting overlapped actors and applying damage
in the EnemyCharacter class
- processing incoming damage, decrementing health, and checking for death
Ignore the branch and its condition, setting IsAttacking will be used in the animblueprint, the delay i used so that damage was dealt mid way through my swinging animation.
Then using the MeleeCapsule shown before is used to get all overlapping actors, but i changed the purple pin to class filter so it would only hit "myEnemyChar" class.
Then simply pushing that thru a for loop, it will do damage to all Enemies. MeleeDamage is simply a float that i set elsewhere. (default is 45)
Here is just converting the float to an int for subtracting from current health, checking if health is too low and kill the actor.
Here's a bit of info about how fortnite uses montages and anim notifies to do a animation-based melee combo system: