How to push a character away when falling on them or moving towards them?

Hi, like the question, I’m working on a devil may cry- like game, and I wonder if there is a neat way to move other enemies away from Player when I land on their heads or simply run towards them. I tried to use on Component Hit and add actor world offset, but I get infinite loop error, which is rediculous. So how do professional studios handle such problems?

Hey @herohana!

You can do it like this inside your enemy character’s blueprint:

Hope this helps :blush:

Thx for the idea ;D It is a good way to do it, but launching character will cause the character to set the movement mode to falling and act like you are in the air. I wonder how those 3A studios do, like dark soul bosses. when they attack you, you are pushed away from your original location without any velocity

For me, when I implemented my suggestion in the third person template, the enemy played the landing animation instead of the falling one when I crashed into it from the side or fell onto it. Maybe you can check if your hit normal is pointing to the air. Regardless, you can play an animation montage to your liking on hit :innocent:

Probably with velocity :person_shrugging: :

Since you’re telling the CMC what to do, this will propagate to all other systems that rely on it - collision, friction, physical interactions and so on.


Another, more nuanced way:

  • apply radial damage with Damage Type Class (make a new Displace class, lets say)

  • use the damage type to preprocess damage values and have the recipient instead apply velocity change to itself:

As a massive bonus, you’ll get the Damage Prevention Channel (last pin of the top node) which will allow you to hide behind obstacles.

2 Likes

Thx for the ideas ;D it is very helpful

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.