// Only need to support blending to 0 for now
if (CurrentPhysicsBlendAlpha != TargetPhysicsBlendAlpha && TargetPhysicsBlendAlpha == 0.f)
{
CurrentPhysicsElapsedTime += DeltaTime;
if (CurrentPhysicsElapsedTime >= PhysicsBlendDuration)
{
CurrentPhysicsElapsedTime = 0.f;
CurrentPhysicsBlendAlpha = TargetPhysicsBlendAlpha;
}
else
CurrentPhysicsBlendAlpha = 1.f - (CurrentPhysicsElapsedTime / PhysicsBlendDuration);
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(RagdollRootBone, CurrentPhysicsBlendAlpha);
if (CurrentPhysicsBlendAlpha == 0.f)
{
GetMesh()->SetCollisionProfileName(TEXT("Minion"));
///GetMesh()->SetRelativeTransform(MeshRelativeTransform);
GetMesh()->AttachTo(GetCapsuleComponent(), NAME_None, EAttachLocation::SnapToTarget, true);
GetMesh()->SetRelativeTransform(MeshRelativeTransform);
GetMesh()->SetAllBodiesBelowSimulatePhysics(RagdollRootBone, false);
IsCharacterRagdoll = false;
}
}
EDIT: Oh and all this code above exists in the Tick function. Also here’s another thread where another user had to modify some engine code to get it to work for him. I can’t modify the engine source in this project specifically atm so I can’t validate that but maybe it adds a little more regarding the issue. (Animated pawn to go ragdoll and back to animations - World Creation - Unreal Engine Forums) Thanks!