Hi all,
I want to play a death animation for a character and then seamlessly blend into a ragdoll. In Unreal Engine 4, I achieved this by enabling the ragdoll at the start of the death montage but setting the blend physics weight to 0, then changing it to 1 as the montage blended out.
However, for UE5.4 I cannot get this to work. Basically, the pawn plays the montage appropriately, but at the point where the ragdoll takes over, suddenly all rigid bodies have their momentum set to 0 so it looks like the body hit an invisible wall or something. Gif below illustrates the problem:
Here is what my code looks like (written in pseudo code for brevity)
** When first playing the death process **
ThirdPersonMesh->SetCollisionProfileName("PlayerRagdoll");
ThirdPersonMesh->SetEnablePhysicsBlending(true);
ThirdPersonMesh->SetSimulatePhysics(true);
ThirdPersonMesh->SetPhysicsBlendWeight(0.0f);
AnimInstance->PlayDeathMontage();
** In Anim Instance **
Montage_Play(RandomDeathAnim);
FOnMontageBlendingOutStarted BlendOutDelegate;
BlendOutDelegate.BindUObject(this, OnBlendOutDeathAnimation);
Montage_SetBlendingOutDelegate(BlendOutDelegate, RandomDeathAnim);
** In On Blend Out Death Animation **
ThirdPersonMesh->SetPhysicsBlendWeight(1.0f);
ThirdPersonMesh->SetAnimInstanceClass(nullptr);
The same issue happens if I don’t enable the ragdoll before playing the montage and just enable it all in the On Blend Out Death Animation sequence.
What am I missing here? Is it an issue with the Animation Blueprint? The Montage itself? Is this a problem caused by the switch from PhysX to Chaos in UE5? I’ve had someone suggest I manually measure the linear and angular velocity of every bone during the montage every tick and then reapply to every bone once the montage finishes, but that seems insane given that it was all handled internally in UE4.