2D sidescroller. I’m using hitscan, (line trace) for the shooting rather than projectile. I’ve got it working, but I can’t figure out how to get the enemy (zombies) to react to taking damage from the back.
I have a model and animations from mixamo. The player character can dodge roll past the zombies and has a couple seconds to shoot them in the back before they turn around or if they’re in their attack animation.
It all works ok, except that I can only get the “front” hit reaction (and death animation) because I can’t figure out how to tell the zombie that its getting hit from the back. I don’t know how to get those neat screenshots people make of their BP (unless they’re just stitching together screenshots) or I’d share what I have.
Basically, the player character is firing the line trace and applying damage and the zombie has an Event AnyDamage that triggers it to play the reaction montage (or die).
Hey there @Ethan_Wolfe! Welcome back to the community! So depending on your setup, you could check the hit location and compare it to the forward vector of the zombie. This thread goes into the vector math used, but the 11th post linked here has an actual BP example. It’ll be slightly different in 2D but not enough to change the overall math.