☠️Death Ragdoll
Last updated
Last updated
The Death Ragdoll State will replace the character by a ragdoll when it dies.
It uses the same State ID (10) as the Death State.
When the Death state is activated, whether when the Health stat is zero or by simply forcing the state; a ragdoll prefab previously created will be instantiated and a force will be applied in the direction of the animations and the stored last Hit from the MDamageable component. The Animal Controller and all its internal components and features will be disabled.
When the Ragdoll prefab is instantiated, it will remap or re-skin all the bones of all the skinned meshes inside the animal controller to the ragdoll bones.
This is how it looks when the mesh :
The Ragdoll Prefab is a copy of the character with all the basic ragdoll requirements (Character Joint components, colliders, and Rigidbodies).
To create a new Ragdoll State. use the Plus [+] button on the States list:
Or duplicate any of the already created Wall Run States Assets of any character you own and drag it to the States List.
The state should have the highest since the character can be killed at any time.
It only needs a Ragdoll prefab that matches your character.
To activate the state you can use the State methods like MAnimal.State_Activate(10).
Usually, the Death state is activated when the Health stat is empty. This connection is set automatically.
A Zone can activate any state.
Animal Reactions can be used to activate the state. Check Reactions
Ragdoll State does not have any exit conditions. It is a permanent state.
Since a ragdoll prefab will replace the Animal Controller, no animation is required.
Reference for the clean ragdoll replacement prefab
Set an angular drag to all the ragdoll rigid bodies
Set an angular drag to all the ragdoll rigid bodies
enable pre-processing in all the Character joint components
What type of collision all the ragdoll rigid bodies will have