Character pushback on projectile hit

Hello!

We’re a group working on an idea for a school project, and I`m doing a bit of research to make the creation process a bit more tidy.

Our plan for the project is to make an arena where you fight other players using spells such as fire bolts. Having it do damage on impact is fine and all, but we want it to push the player it hits backwards on impact.

To clarify with an example: Player 1 shoot’s a fire bolt at Player 2. Player 2 gets knocked backwards.

As we’re relatively new to blueprints, I hope someone has the time to explain or show how one could do this!

I’ve checked similar threads on this forum, sadly none of them seem to have a clear and final answer to this question! (So I guess there are more than just us wondering about this!)

Best regards,
Mats J

You could simply apply an impulse to the player when they are hit.

Create a vector in the direction of the impact ( PlayerPos - FireballPos ), Normalize it, and then scale that vector by some scalar for power (you’ll likely need to play with this value a bit, maybe put it in your options or somewhere so you can easily tweak it as needed ).

Finally just call SetPhysicsLinearVelocity with your new vector (make sure you set the Add To Current option to preserve their current velocity) and that should be it.