[4.7] Cannot Have Partial Blend of Ragdoll / Regular animations on skeletal mesh component, its always all or nothing

Dear Epic,

I am using the following C++ code to try and initiate a partial-ragdoll state so I can apply an impulse at a point of impact to a humanoid skeletal mesh holding a weapon

#Background

Again this is a perfectly normal humanoid skeleton based on 3ds max biped.

I have plenty of animations playing on the mesh
I know the ragdoll itself works great and does not go bonkers during simulation.

If I just activate ragdoll completely, the ragdoll behaves normally

#The Blend Code
Here is my blend code

//set partial rag doll for a period of time
PartialRagDollActive = true;
SETTIMER(AVCharCombat::ClearPartialRagdoll,1,false);
	 
//GetMesh()->SetAllBodiesBelowSimulatePhysics("Bip01-Spine2",true);
GetMesh()->bBlendPhysics = true;   
GetMesh()->bEnablePhysicsOnDedicatedServer = true;
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(
	"Bip01-Spine2", 
	0.5	//weight for all
);

GetMesh()->AddImpulse(Hit.ImpactNormal * 30000, "Bip01-R-Hand");

#Result

Using this code, nothing happens at all (the timer currently does not do anything after firing, so I am fully testing whether I ever get blending of physics to work

#Other Code Path

If I uncomment the setting of simulate directly

GetMesh()->SetAllBodiesBelowSimulatePhysics("Bip01-Spine2",true);  //<~~~
GetMesh()->bBlendPhysics = true;   
GetMesh()->bEnablePhysicsOnDedicatedServer = true;
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(
	"Bip01-Spine2", 
	0.9	//weight for all
);

Now the upper body goes into total ragdoll, perpetually, never settling, and this happens whether I use a blend wait of 0.1, 0.5, or 0.9.

In other words, its all or nothing! Either the arms are completely limp, not playing the standing/idle/swinging animations even a little bit, or the animations are in complete control.

I cannot get partial ragdoll, only full on ragdoll or no ragdoll :slight_smile:

#What Works

I can successfully get the upper body bones to enter ragdoll 100%, and then get them back out, while legs continue to play normal animations.

The issue is that I want the animations to have a partial influence on the upper body, while the rag doll impulse dislocates the bones from normal positions, simulating a recoil from a weapon impact.

It is this partial ragdoll influence upon the existing upper body animations that I cannot figure out how to achieve.

#Summary

I cannot figure out how to have a partial ragdoll state at all, please help! Thanks!

#:heart:

Rama

PS: Even only having upper body simulate physics was going completely bonkers until I changed the collision of the mesh to be “Ragdoll” instead of Character mesh.

Now the arms flop around great, but its 100% ragdoll, all the time, not a blend

Thanks!

Hi, Rama,

You can check the example map, PhysicsAnimation.umap in the ContentExample. That has the hit reaction example.

You still have to call,

  1. SetAllBodiesBelowSimulatePhysics
  2. SetAllBodiesBelowPhysicsBlendWeight

In the order because 1 dictates whether it would simulate or not. Physics world doesn’t simulate half way. It just simulates. 2 dictates whether or not how much you’d like to blend with it.

If you look at our example, we blend slowly using timeline curve, and when get out slowly using curve. You can do this linearly, just giving 0->1 over 0.25 times, and then 1->0 over 0.25 times. You can disable simulate physics before coming out.

Hope this helps.

–Lina,

#Thank You Lina!

As per your suggestions I tried this

GetMesh()->SetAllBodiesBelowSimulatePhysics("Bip01-Spine2",true);  //<~~~
 **GetMesh()->bBlendPhysics = false;**   
 GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(
     "Bip01-Spine2", 
     0.9    //weight for all
 );

and it works now perfectly!

The bBlendPhysics line can also simply not be included

GetMesh()->SetAllBodiesBelowSimulatePhysics("Bip01-Spine2",true);  //<~~~
 GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(
     "Bip01-Spine2", 
     0.9    //weight for all
 );

The line in question

GetMesh()->bBlendPhysics = false

Setting this to false is what made things start working properly.

Thank you very much for your help Lina!

#Summary

Things to look out for when trying to do a physics blend with animation

a. make sure character mesh is set to use “Ragdoll” not character mesh for collision

b. use code similar to this, avoid setting bBlendPhysics = true;

GetMesh()->SetAllBodiesBelowSimulatePhysics("Bip01-Spine2",true);
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(
         "Bip01-Spine2", 
         0.5    //weight for all
     );

#:heart:

Rama

Hi there,

Im trying to do something similar in blueprints. However i want the entire hierarchy of bodies to ragdoll, so not just from a spine joint, but all below Pelvis (if using the standard ue4 skeleton). When i set it to 1 using excact same method as Shown above, it works just fine. If i set it to 0.5 or any value not 0 or 1, my mesh starts to spin out of control. Is it at all possible to do what i try to do here?

Posted a video showing my setup here: - YouTube

i’ve posted a video showing what i do and what i get: - YouTube

Hope someone can spot what im doing wrong? The video is from 4.11.0 Preview 3 btw, but also tried this in 4.10.1 with same result.