Character knockback

I am trying to figure out how to make an enemy knock back when ran into by the player character.

I have set up overlap events ect and decided to use Launch Character to do it.

Problem is the enemy only moves along the vector based on which direction he is facing. What I want is for it to launch away from the main character depending on the direction I run into it from.

Is it the case that I cant use Launch Char for this sort of thing?

Any advice would be much appreciated. :wink:

I seem to have got it to work by using a Hit event instead .

instead of fowardVector, you need a vector from the player to the enemy.
a hit normal can work, but if you want to push things from farther away, or you want the things that can be pushed to be able to overlap pawns, you can use:

vectorPointingFromMeToEnemy = EnemyPosition - PlayerPosition;
LaunchForce = vectorPointingFromMeToEnemy.Normalize() * KnockBackAmount;
LaunchCharacter( LaunchForce );
1 Like

Thank you for your help. Though without seeing a Blueprint im a little confused as to how to get enemy and player positions. could you elaborate ?

to get the enemies position you drag that blue pin off of the hit event that says “other Actor” and get actor location. They to get your own location you just right click and get actor location anywhere in your blueprint.

this helped me 10 years later!