Hi, I’m struggling trying to activate ragdoll on my Character.
i made a Health Component and added it to my character blueprint, when the Character’s health is 0 i’m trying to activate the ragdoll for the skeletal mesh.
I’m using the default many character, so it has it Physics Asset already configured.
but as my title said, when the ragdoll activates, the SkeletalMesh goes through the floor, i tried the command in the console “show collision” and my capsule component is still in the floor, but the skeletal mesh seems to loose the collision.
I tried using collision “Query and Physics”, “PhysicsActor”, “Ragdoll” and it always falls.
Also i tried to put my character in the map, check simulated physics and collision “PhysicsActor”, press play in editor and it works, so is something that i’m not doing right in code.
Here is the code i’m using in c++ to activate the ragdoll
void UHealthComponent::EnableRagdoll(ACharacter* Character)
{
if (!Character) return;
USkeletalMeshComponent* MeshComp = Character->GetMesh();
if (!MeshComp) return;
MeshComp->SetCollisionProfileName(UCollisionProfile::PhysicsActor_ProfileName);
MeshComp->SetSimulatePhysics(true);
MeshComp->WakeAllRigidBodies();
}
please can someone help me to figure out how to solve this issue ?
Thanks in advance for all the help.
Also i tried to add some nodes in the NPC blueprint to activate only used these two nodes and it worked
but i need to activate it from c++, any help please