How to implement enemy pushback

I’d like to implement enemy pushback, like here in the video.

I have an enemy who has these character movement component, mesh and capsule component - parent class is Character.

Which function should I use to achive this effect on some some event?

For example I have event on hit (by bullet), there is a Hit Location, Hit normal, etc…

1 Like

since you’re using characters you could try the LaunchCharacter Node,

or you could do it manually with SetActorLocation with sweep or maybe AddInputVector

1 Like

I am traing to use launch character.

I have two problems:
After launch the character goes to the state is Faling even if I set the vector Z to 0

The second problem is that the launch will perform the move very quickly. Is there any way to slow it down ? But keep the distance?

you might have to create your own system, to point you in the right direction

start with a timeline, VInterptConstant a vector and use SetActorLocation with sweep, OnSweepHit stop the timeline

Is function Add Actor world Offset better fot this mechanism?

yep thats fine too, there are lots of ways to move an actor, its just finding what works for you

Here’s another:

image

The Character Movement Component understands physical impulses, and the root component does not need to simulate physics for this to work. Adding an Impulse should work well here - it should slide the character around without changing move mode, providing you do not add Z.


And to add to the above, we do not need to be that explicit with physical impulses and target the CMC directly; here’s the effect of the Radial Force Component affecting the CMCs:

1 Like