if (IsCharacterRagdoll)
{
// Update the Capsule’s World Space Location
GetCapsuleComponent()->SetWorldLocation(GetMesh()->GetSocketLocation(RagdollRootBone) +
FVector(0.f, 0.f, GetCapsuleComponent()->GetScaledCapsuleHalfHeight()));
if (!IsGettingUp && !GetCharacterMovement()->IsFalling()) // && !GetCharacterMovement()->IsMovingOnGround())
{
if (!GetWorldTimerManager().IsTimerActive(OnGettingUp_Timer))
GetWorldTimerManager().SetTimer(OnGettingUp_Timer, this, &ATDCharacter::OnGettingUp, GetUpDelay);
IsGettingUp = true;
}
}
else if (GetCharacterMovement()->IsFalling())
{
GetMesh()->SetCollisionProfileName(TEXT("Ragdoll"));
GetMesh()->SetAllBodiesBelowSimulatePhysics(RagdollRootBone, true);
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(RagdollRootBone, 1.f);
// May not be needed
//GetMesh()->WakeAllRigidBodies();
CurrentPhysicsBlendAlpha = 1.f;
TargetPhysicsBlendAlpha = 1.f;
IsCharacterRagdoll = true;
}