Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Mecanim to ragdoll and back to Mecanim?

Discussion in 'Editor & General Support' started by Damocles, Dec 6, 2012.

  1. Damocles

    Damocles

    Joined:
    Jul 21, 2012
    Posts:
    39
    Has anyone figured out how to go from Ragdoll back to Animator/Mecanim yet?

    Going to ragdoll is easy - switch off isKinematic on the various rigid bodies in the model, and disable the Animator. The problem is that simply doing this in reverse causes the model to instantly jump to the animation without any form of transition. Not to mention the root rotation/position is changed dramatically, so the new animation plays with the model lying on the floor :)

    I thought I could be tricksy and make it play a "dead" anim - I made an animation take with no keys in an override layer - then fade that layer out, but it didn't work. It treats a no-keys animation as whatever position the model was in before the Animator was disabled.

    So is there a trick to this?

    Right now it's looking like I'm going to have to create a mini-animation script to blend the bones positions from their ragdoll positions, to the first frame of the "getting up" animation, then activate the Animator at that point. I don't particularly like this method, as it's messy and will require sampling the bones positions from the start of each "get up" animation for every character that needs it.
     
  2. foxter888

    foxter888

    Joined:
    May 3, 2010
    Posts:
    530
    i'm sitting on the same boat as you, normally it just flops right over when i disable the animator. the only think i can think is getting the bones transforms and go from there lol.
     
  3. l5p4ngl312

    l5p4ngl312

    Joined:
    Jan 29, 2013
    Posts:
    1
    I'd also be interested in a way to do this
     
  4. JamieFristrom

    JamieFristrom

    Joined:
    Nov 2, 2012
    Posts:
    20
    Yep, I want exactly this too.
    Auto Ragdoll was on the Mecanim road map from a year ago but I guess it still hasn't arrived yet...
    Hey Damocles, did you write that script? Did it work?
     
  5. Damocles

    Damocles

    Joined:
    Jul 21, 2012
    Posts:
    39
    Not yet, I've been putting it off expecting it to be part of Mecanim, but we all know how that's working out.

    I think I saw something on the asset store that does the same thing, but I can't remember it's name off the top of my head.
     
    Sandy-360 likes this.
  6. rcober

    rcober

    Joined:
    Jan 26, 2013
    Posts:
    52
  7. Damocles

    Damocles

    Joined:
    Jul 21, 2012
    Posts:
    39
    Thanks for the link, rcober. Looks like exactly what I was planning on making myself - so that should save me a good number of hours.
     
  8. Kavorka

    Kavorka

    Joined:
    Sep 15, 2012
    Posts:
    237
    Last edited: Feb 1, 2015
  9. Tekksin

    Tekksin

    Joined:
    Oct 20, 2013
    Posts:
    32
    the initial link has a project that isn't compatible with the unity of today, and the one posted above my comment links to a channel that doesn't show how to do anything.
     
unityunity