Search Unity

Going from ragdoll to animated model

Discussion in 'Animation' started by IbanCira, Sep 23, 2020.

  1. IbanCira

    IbanCira

    Joined:
    Aug 17, 2020
    Posts:
    1
    Hi, I hope this is the right category to post this. I'm trying to make a unit go into ragdoll and back. The going to ragdoll part is going well, I basically just followed this tutorial from Jason Weimann (
    ) but I'm having problems with the going back part.

    The tutorial suggests using two objects of the same rigged character, one being a ragdoll and the other one simply having the animator component (both being child objects of the character). For going into ragdoll mode, the ragdoll takes the current position and speed of the animated model, the animated model is disabled and the ragdoll enabled and off we go, that's my current setup.

    From what I could gather, what I should do to achieve the reverse, would be to slerp all the bones of the ragdoll into the standing up animation initial position and swap the ragdoll for the animated model. Sounds simple enough. The thing is that when the ragdoll is enabled and moves away from its original position, the animated model not only stays there, but it cannot be moved to the ragdoll's position by code, at least not while the animator component is enabled. And disabling it for moving the model is of no use, since once it's enabled, the model returns to it's original position (the last position the animator was enabled).

    Does anyone have any idea how to solve this? Or should I approach the whole ragdoll thing in a different way?

    Thanks for reading.
     
  2. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    I had some success at that using hack solutions. First, on moving the character controller by ragdoll: I remember having to detach the skeleton and character mesh from the root GameObject when the ragdoll is initiated; otherwise,trying to drive the root object by ragdoll bone will lead to dependency loop and the character will fly to hyperspace. Just remember to reattach skeleton back before Animator component is re-enabled. For animation blending out of ragdoll, I resorted to inverse kinematics instead of caching bone coordinates. I've converted the ragdoll bone coords into IK helpers' positions that best represent them. Then, while "getting up" animation was playing, I faded IK strength to zero
     
    radiantboy and DetaPlayFounder like this.
  3. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Im looking at this right now, did anyone find any good resources for going from ragdoll back to animation ?