Setting Velocity Is Extremely Inconsistent

I have an enemy, when it dies I turn on Ragdoll so it slumps to the floor. But I wanted the added effect of adding velocity away from the player upon death, by a means of adding extra knock-back and force

However, the results are insanely inconsistent. Some times it slumps to the floor, other is flies off a thousand miles away in the blink of an eye.

I have tried using many adding force nodes for this and they all yield the same results. (Add Force, Set Velocity, Add Impulse, Launch Character).

I am Turning the Mesh into a Ragdoll, and launching the mesh itself. I have tried detaching it from the parent controller, so it is literally just a static mesh with rag-doll physics and nothing else. But I still get these poor and inconsistent results.

Any Tips?

Hi, it is not the answer you expect because you need to find a source of this behavior. But there is a way you can minimize the effect:

  1. Add linear drag.
  2. Also you can clamp final velocity in “Event Tick” like this: this->SetComponentVelocity( GetComponentVelocity().GetClampedToMaxSize(float Your_Max_Velocity) )

Some ideas to find the reason: what about mass? Is it greater than 0? Additionally, try to turn on CCD in characters physics. Is it ok when you simulate ragdoll in physics asset tab?

Hi,
If you have death animations for the character you’re working on, you can try playing those anims on death, and enabling ragdoll on OnBlendOut

It’s the method I tried on the latest project I’m working on, and it does seem satisfactory, but not perfect.

Hi Felix, Clamping the velocity seems like it would help, but I am not sure how to pull that off with blueprints. I tried the other things, and they help to a degree. So it’s better than it was, but it’s only masking the inconsistency.
I’ve always had issues with Ue4 and changing velocity. I never had these kinds of issues with Unity. So I’m not sure why it’s happening here.

Hi, sadly I don’t have animations for deaths. The enemies in the game are spiders and are meant to be shunted away from the player when hit from a blast of a shotgun on death. The only way I can see that this will work is by adding force to the rag-doll bodies upon death.

Okay, I seem to have found a solution after returning to the problem. Annoyingly, it seems the only thing I did wrong was use the wrong node. There are roughly 10 nodes in Ue4 all designed to add velocity to actors, and there aren’t any real discernible differences between them all, except one; “Set All Physics Linear Velocity”. This seems to be the only node that adds velocity reliably. All the others do the exact same; which is add velocity but do so with extreme inconsistency.