Transition from 2D bone-based animation to ragdoll?

My goal is to create a 2D character that moves mostly with simple bone-based animation (can run, jump, etc), but sometimes falls like a ragdoll.

I originally created a character according to this tutorial. I got the simplest hierarchy of sprites of limbs for easy creation of animation. At the root of these sprites was an empty object, to which I attached a RigidBody2D and Collider2D, in order to be able to realize the physics of movements (running, jumping, etc.).

Then I began to think about the physics of the ragdoll and I found some information here:

“A common example of this is the “ragdoll” effect where a character normally moves under animation but is thrown physically by an explosion or a heavy collision. The character’s limbs can each be given their own Rigidbody component with IsKinematic enabled by default. The limbs will move normallly by animation until IsKinematic is switched off for all of them and they immediately behave as physics objects. At this point, a collision or explosion force will send the character flying with its limbs thrown in a convincing way.”

In the end, I attached a kinematic RigidBody2D and a Collider2D for all the limbs of the character that were connected with Hinge Joints. At the moment when the character should become a ragdoll, I turn off the animator and make the RigidBody2D of all his limbs dynamic. But the collider of the root element with a dynamic rigid body collides with the colliders of the child elements, whose RigidBody2D is still kinematic. Because of this, the movement becomes unpredictable.

The first thing that occurred to me was to take the root element collider out of the range of other colliders and place it under the characters’ legs. And it worked, the character could move animatedly. And I even managed to make it a ragdoll, but the root object fell off. I tried to connect it with a child using Fixed Joint, and as a result, physics did not act on the root element at all.

I’m starting to get confused in what I’m doing. It seems that I am doing something wrong with the root element. Probably everything should work as stated in my quote, but I do not understand how to combine it with my root element, on which there is a RigidBody2D and a Collider2D. I need your help!

I have same problem. Did you somehow figured it out?