I’m trying to make an adaptation of Team Fortress 2 in Overwatch (original I know).
I’m trying to find out how to make a system where the player’s melee damage is increased when facing an enemy player’s back, specifically to try and replicate The Spy’s ability to one-shot backstab.
I understand that this is not an easy task, but I can’t even seem to devise a system to only increase the player’s melee damage without increasing any other attack damage.
Is there something blatantly obvious I’m missing, or is this something that hasn’t even been tried before? Some help would be appreciated.
I did this:
Player Dealt Damage
Event Ability == Button(Melee)
Horizontal Facing Angle Of(Victim) <= Add(Horizontal Facing Angle Of(Event Player), 50)
Horizontal Facing Angle Of(Victim) >= Subtract(Horizontal Facing Angle Of(Event Player), 50)
Damage(Victim, Event Player, Event Damage)
Horizontal Facing Angle to check if both look at the same direction and I introduced a difference of 50 in each direction to make it easier to hit. You can decrease or increase the value if you prefer the area to be smaller or larger, respectively.
To verify that it’s a melee attack, I used
Event Ability == Button(Melee).
The damage it deals is increased by 100% (double damage). You can modify
Event Damage and put a number if you want to.
You can simplify the angle checks and use the Dot Product of Eye Position Attacker and Victim or their Facing Direction, the Dot Product is commutative meaning the order of operands or arguments to put in doesn’t matter.
You check the Dot Product, which will return a Scalar (single integer number), against greater than or equal 1, if that’s true it means both inputs have the same direction.
If it less than or equal -1, they have opposite directions.
If it is equal to 0, then they have orthogonal or perpendicular direction to each other, which is equal of having a horizontal angle of 90 degree.