Transition Between Regular Animations and Ragdoll Physics

Hi everybody,

I know how to create animations, and I know how to set up rag doll physics on a character. My main question is how do I write a code that ends regular animations (walking, running, fighting etc.) upon dying, and transitions into a rag doll effect on death.

Alternatively, I’d like to assign certain health to certain body part, and have it respond to rag doll physics without requiring the character to die. In other words, if the character gets shot in the head, I want his head to swing back, and snap back into place. Similarly, I would like that to happen to shoulders, arms, chest, and legs.

Thanks for your help

Hello again,

If you want to disable all rigidbody’s, you can simple do:

function DisableRagdoll() {
    var rb:Rigidbody;
    for (rb in GetComponentsInChildren(Rigidbody)) {
        rb.enabled = false;
    }
}

To enable it, just replace rb.enabled = false; with rb.enabled =true;

Hope this helps, Benproductions1

If this is what you want:

“Alternatively, I’d like to assign certain health to certain body part, and have it respond to rag doll physics without requiring the character to die. In other words, if the character gets shot in the head, I want his head to swing back, and snap back into place. Similarly, I would like that to happen to shoulders, arms, chest, and legs.”

you should look at this AnimFollow.

AnimFollow makes a ragdoll follow an animation with some strength and lets you lower the strength for individual body parts so that they may be affected by physics. Then lerp the strength back to make it follow the animation again.

Maybe this is what you are looking for