Possible to "freeze" joints on skeletal mesh while simulating ragdoll physics?

Is it possible to simulate ragdoll physics on a character, but freeze the joints in the meantime? I think it would be a cool effect if enemies hit by my freeze gun would freeze up in their position while falling over and respond to physics. Pretty much turning into manequins when they’re being hit. Meaning, if I hit them while they’re running they would freeze up in a running pose and fall over. If I hit them while they’re crouching they’d freeze up in that position etc.

I can’t seem to find any blueprint functions to set joint/bone constraint at runtime. Or a function to lock bone momevent.

I don’t know what the current BP state is, but I had to expose my own BP nodes for updating joint motors back when I was implementing it.
Just in case you wouldn’t mind trying the same:


ChangeNamedMotors(float InSpring, float InDamping, float InForceLimit, const TArray<FName>& BoneNames)
{

	UPhysicsAsset* const PhysicsAsset = GetMesh()->GetPhysicsAsset();
	if (!PhysicsAsset)
	{
		return;
	}

	TArray<FConstraintInstance*> Constraints = GetMesh()->Constraints;

	for (int32 i = 0; i < Constraints.Num(); i++)
	{
		FConstraintInstance* Instance = Constraints*;
		if (BoneNames.Contains(Instance->JointName))
		{
			Constraints*->SetAngularDriveParams(InSpring, InDamping, InForceLimit);
		}
	}
}

This function was on my Character. I just had orientation drive turned on all the joints I wanted to control, then spring strength is all that was really needed to modify, since you can use UpdateJointsFromAnimation on the skeletalmesh to get the ragdoll joints to retain a pose or animation.

Keep in mind, I haven’t tried this. But as a workaround (if you don’t want to touch c++) you might be able to make an duplicate physics asset, turn angular drive on all joints and set very high strength values. Then in game before activating ragdoll you could use SetPhysicsAsset() on the mesh from BP. I’m not 100% sure it won’t cause any visual disturbances, or if switching in game even works, but it’s an idea. So basically you’d be creating one physics asset for normal floppy ragdoll, and another that is very stiff (although it still bends a little, so I’m not sure it’ll be perfect for a “freeze”).

no understand

Its a bit of a well kept secret among developers it seems to me…If everyone knew how to do this then it seems that good fighting games would be “too easy” to make, and it would kind of be like inflation of a currency if that makes any sense. Too much money devalues a currency and too much know how of this system would do the same to the game market through saturation of fighting games. This is just a subjective assessment of mine after trying alot, but hey I could be very wrong…good luck though!

Old page bump, but anyone got a bit more in depth explanation on how to implement this? I’m not too CPP savvy, but I’m trying to set the “Set Angular Drive Params” blueprint node to work based on per bone rather full body. I added this along with exposing with ufunction, but I’m getting a strange error on compile even though intellisense doesn’t give me any issues.

Any helps appreciated as always, thanks in advanced…

Edit:

Nvm, solved…

was using in the decleration:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = “Components|SkeletalMesh”)
void SetSingleBoneMotorsAngularDriveParams(float InSpring, float InDamping, float InForceLimit, const TArray<FName>& BoneNames);

Just needed:
UFUNCTION(BlueprintCallable, Category = “Components|SkeletalMesh”)
void SetSingleBoneMotorsAngularDriveParams(float InSpring, float InDamping, float InForceLimit, const TArray<FName>& BoneNames);

bumping to state that this is not even remotely true at all, for anyone coming across this post. its not any kind of tin foil hat wearing secret…all the documentation for rigid/physical body simulation and physics exist on the ue4 site as well as a slew of content on YT to watch about it. the reason its not so spread an commonly talked about is becuase of the extreme amount of work involved in simply explaining it.

The precise process to freeze a mesh as hit by a freezegun - asked by OP 2 years ago, is called a Pose Snapshot.
It’s been explained many times, and there is a somewhat comprehensive live training for it that also covers all sorts of other ragdoll issues:https://youtube.com/watch?v=nkj6PAbGYtM
@thelazylion

Not sure if this is what you were trying to do, but you can activate a profile on “all joints below”.
That means that you create a PHAT profile as rigid or loose as you need, and apply it to the joint you want to isolate and simulate on.
-picture it like this, if the freeze gun hits the arm, you freeze the arm in place while the rest still works.

Did you ever get this to work? I have exact same task and I run out of ideas how to do it.
Need to prevent bones from further rotation after it takes certain shape but I need to keep simulating whole body. Before I started to dig into cpp I have tried a lot of different approaches but none of them were good enough.