- Home /
Mechainm Animation to Ragdoll
Hello there,
is there any way how to switch a character to ragdoll while he's walking or sprinting...
like this, but he should not be able to stand up again. I just want him to fall on the ground while playing an animation.
Hope you can help me.
Thanks in advance!!
Not tried this myself but it appears to be in the unity manual
Answer by tanoshimi · Dec 02, 2014 at 10:57 PM
Transition from Mecanim to ragdoll is relatively straightforward:
Make sure your character has an Animator controller with your Mecanim animations set up.
Then add the appropriate ragdoll colliders, rigidbodies, and joints to your character. (You can use the Ragdoll wizard to do this automatically for you if you want)
When you want Mecanim to provide the animation control: enable the Animator, and set the "Is Kinematic" option on all the limb's rigidbodies to be true. It sounds like this will be your initial starting state. ("Is Kinematic = true" tells Unity that you (or rather, the Animator in this case) will move the limbs manually)
At the point you want to switch the character to ragdoll control: disable the Animator, and set the "Is Kinematic" option on all the limb's rigidbodies to be false. ("Is Kinematic = false" tells Unity that the PhysX system should control the limb's movement)
If you want to retain the forward momentum that the Animator controller had at the point they change to ragdoll, you can apply a force to the rigidbody on the hips based on the last Animator.deltaPosition.
As it happens, I'm working on my own script at the moment intended to go the other way - from ragdoll to Mecanim control, which is proving more tricky... the video you linked to was interesting as I'd not seen it before and seems very similar to my own! https://www.youtube.com/watch?v=OwlPxTxyXv0&feature=youtu.be
Your answer
Follow this Question
Related Questions
Character Contoller with Ragdoll 1 Answer
How do I attach an animation with a ragdoll 0 Answers
Active ragdolls? 1 Answer
2D Ragdoll 1 Answer
Character animation/ragdoll problem 1 Answer