turning a ragdoll in to animated skeleton

Hello all,

I have a ragdoll with animation clips attached to it.
I have used the DragRigidBody script to throu the ragdoll around.

Now, how can I smoothly transition back to the animation?

Currently, I wait 5 seconds (yield) before I re-enable animation. The result is that the ragdoll ‘disappears’ from its current fallen position and reappers in the character’s starting position then continues to play the desired animation.

How can I avoid this and make it more transparent?

I have read many posts and in summary here are the approaches:

  • Use two characters, ragdoll and non-ragdoll, attached to one another via spring joints.

http://forum.unity3d.com/viewtopic.php?t=30242&highlight=ragdoll+animation

  • replace ragdoll with animation and back.
    Need an example on how to get the animation “control” transform to follow the ragdoll.

  • Bone by bone manipulation
    Very messy

  • Apply forces to the bones to “force” the ragdoll to balance and standup right
    Surely there’s a better way than re-inventing the wheel; I’d end up re-writing what entire companies have done over time.

  • Locomotion
    having a look at the unity demo

Any help?

I’d use instantiate and destroy to swap out the ragdoll character with the animated character and visa versa; when the ragdoll stops, save a transform value, destroy the ragdoll prefab, and instantiate the animated prefab at that transform location.

BTW, welcome to the forums!

Thanks for your reply.
I u derstand.
One question, people keep referring to the “control object” of the animation which defines where the animation will ‘appear’ in. What is this “control” programatically.

also, can you provide an example on how to save the transform of a ragdoll and reapply it to a skeletal object ? Do I need to do that to each rigidbody in the skeleton or just the root object in the hierarchy?

I’m not sure what you mean by “control object”, unless it’s the root element in the object’s heirarchy, or an empty gameobject to which another object is parented.

the transform component (different from the Transform class) need not actually be “saved”, it can just be called in a script to get the location of the object to which it’s attached. So to swap out the ragdoll, attach a script something like this to it

var SkinnedMesh : Transform;

function SwapOut () {
Instantiate (SkinnedMesh, transform.position, transform.rotation); //this will instantiate the skinned mesh at the ragdoll's current position and rotation

Destroy (gameObject); //destroys the ragdoll
}

then do the opposite on the skinned mesh, to swap it out with the ragdoll. You’ll need to put in some way of calling the SwapOut function, when the condition to do the swap is met, whatever it is (i.e. when the ragdoll stop moving, or onmouseup, etc…).

Take a look here: http://unity3d.com/support/documentation/Manual/Instantiating%20Prefabs.html for more on this.

HTH!