Hi I’ve been working on this for some time. The method I use for making a ragdoll is this:
Step 1: Make a ragdoll by creating simple objects with rigid body constraints. Give each ragdoll piece a name with a prefix+bone it will be connected to e.g. “RD-head”
Step 2: Add empties to the head of each bone in your rig. Parent these empties to their corresponding bone. (thus, each empty will follow the location and rotation of their corresponding bone) give each of these a name with a prefix+bone name e.g. “FOLLOW-head”
Step 3: At the tail end of each bone, create an empty. Parent this to the ragdoll piece that corresponds to that bone. This will act as an IK target for the bone during the character’s death. Name these empties with a prefix + bone name. e.g. “IK-head”
Step 4: At the tail end of each bone and offset from the bone’s local Z axis, create empties. Parent these to the IK empties made in step 3. These will act as pole targets for the bones during the character’s death. Name these with a prefix + bone name. e.g. “POLE-head”
Step 5: Add IK constraints to each bone, targeting the IK empties made in step 3 and pole targeting the empties made in step 4. Make the chain length 1. Set the influence of each of these constraints to 0.
Step 6: In the game logic for each ragdoll piece, make it so that at the start of the game, the pieces are parented to the empties created in step 2. Also, you’ll need to suspend dynamics. This will make it so that your ragdoll follows the armature. Make it so that whatever trigger’s your character’s death also deparents the ragdoll pieces from these empties and restores dynamics. This will make it so your ragdoll flops.
Step 7: For each bone in the armature, create an Armature actuator set to “Set Influence” mode. Make it so that whatever triggers your character’s death, also sets the influence of your IK constraints to 1. This will make it so that your armature will follow the IK & POLE targets that are parented to the ragdoll pieces. You will also need to do this for a ‘COPY_LOCATION’ constraint to the hip bone targeting the Ragdoll’s hip piece.
I’m currently working on a plugin that does all this for you, but it’s been a bit of a tricky project… Here’s an example of this method at work (I was working on making it so the character could die, then get back up.):
GOTCHAS: I’ve noticed that if your character’s animation forces a ragdoll piece to go beyond the limits set in the rigid body constraints for that ragdoll piece, then that piece is in a dangerous zone. If the character dies while that piece is in the danger zone, it will break the rigid body constraint and the ragdoll piece will go flying off. The best way to prevent this is to make some limit rotation constraints and transform locks on your character’s armature, then match these limits to the rigid body constraint’s limits. This will prevent the possibility of going beyond the rigid body constraint limits.