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

How can i prevent ragdolls from stretching and spazzing out?

Discussion in 'Physics' started by Nanako, May 26, 2015.

  1. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    I've made a ragdoll teddybear. I used the ragdoll wizard a little initially to see how it works, but it wouldn't take an armature with only 7 bones, so i ultimately made this myself, with colliders, rigidbodies, and character joints, on each part.

    As long as i move this little guy around slowly, and don't get him caught on things, he's fine;



    But if i move him too fast, or swing him around in a way that part (not all) of him hits an object, bad things happen.



    My best guess at what's happening here, is that high forces are sending the limb rigidbodies flying, and they get caught on something in the scene, preventing them from coming back.

    But i don't understand HOW this can happen. The character joints have a breakforce set to infinity, so surely that should prevent them from going any distance from their starting point, no matter how much force they're under?

    The right leg in this case flew about 100m and got stuck behind a little hill in the distance.

    Probably relevant, here's the full inspector readout for that right leg (most of these values are just defaults)

     
  2. Robert-HGG

    Robert-HGG

    Joined:
    May 27, 2015
    Posts:
    10
    I am struggling with the same issue for days. I've tried everything and there is no fix other than limiting ragdoll speed!

    Ragdolls are broken and extremely unstable in Unity 5.
     
  3. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    I've found a solution which seems to work perfectly now. Enable projection on the character joints.

    default settings just magically made the problem go away.
     
  4. MaiJingNan

    MaiJingNan

    Joined:
    Jul 24, 2016
    Posts:
    1
    thanks Nanako,your help work for me
     
  5. wesleywh

    wesleywh

    Joined:
    Jun 8, 2014
    Posts:
    6
    Tried this and it worked like a charm for me. Thanks for the post!
     
  6. sdclark79

    sdclark79

    Joined:
    Feb 6, 2017
    Posts:
    21
    I could be wrong, but I'm pretty sure this is a collision issue. I've had a similar issue with ragdolls, and the issue ended up being resolved by working out layer collisions in Edit->Project Settings->Physics
     
  7. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    174
    None of these works in high speed collision impact, setting max depentration velocity helps, but it would cause some other issues, such as ignore collision impact.
     
  8. Plystire

    Plystire

    Joined:
    Oct 30, 2016
    Posts:
    142
    Ragdolls don't normally behave the best when paired with high velocity.
     
    SparrowGS likes this.
  9. HOEB

    HOEB

    Joined:
    Mar 31, 2017
    Posts:
    1
    Thanks Nanako. It worked fine for me.
     
  10. Jasmin1347

    Jasmin1347

    Joined:
    Jan 24, 2018
    Posts:
    2
    Thanks Nanako. It working fine.:)
     
  11. TheGameLearner

    TheGameLearner

    Joined:
    Feb 10, 2018
    Posts:
    18
    Thanks @nanako.693001, I was able to use your enabling option.... saved me tons of work.
     
  12. NathanJSmith

    NathanJSmith

    Joined:
    May 11, 2018
    Posts:
    57
    TheGameLearner likes this.
  13. joeyether40

    joeyether40

    Joined:
    Jan 26, 2018
    Posts:
    20
    How do you enable character joints . I am also having this stretching issue with my character
     
  14. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    120
    thank you so much it worked for me
     
  15. joeyether40

    joeyether40

    Joined:
    Jan 26, 2018
    Posts:
    20
    How did you get this to work? I do not see where to enable projection
     
  16. TheGameLearner

    TheGameLearner

    Joined:
    Feb 10, 2018
    Posts:
    18
  17. joeyether40

    joeyether40

    Joined:
    Jan 26, 2018
    Posts:
    20
    i was using Configurable joints and that joint did not have that setting. I switched to character joint and used that and now no stretching ty
     
  18. Hoorza

    Hoorza

    Joined:
    May 8, 2016
    Posts:
    35
    You are a legend. Works like a charm. So far. Need to test the collisions now. Cheerio
     
  19. RastaCat33

    RastaCat33

    Joined:
    Jan 26, 2017
    Posts:
    7
    Uou, that is what I was looking for so long... Thank you very much!
     
  20. mjc33

    mjc33

    Joined:
    Oct 9, 2019
    Posts:
    17
    5 years later and @Nanako solution still works great with the 2020 alpha, I was having issues where unity was crashing because my ragdoll was flying out of bounds/at too high velocities due to spaghettification glitches, this fully fixed it
     
  21. alenushkamoscow

    alenushkamoscow

    Joined:
    Jan 6, 2019
    Posts:
    5
    Works for me in 2019.3.7f1) Thank you very much!
     
  22. Short_Barrel_Works

    Short_Barrel_Works

    Joined:
    Sep 25, 2018
    Posts:
    2
    @Nanako solution worked like a charm, but needs a litlle bit tweaking for my purpose

    However, In my case streching still occured a little bit, althought it isn't as bad as before.
    so, if you really-really need to eliminate streching at all cost, don't forget to set the Projection Distance to 0.01 or lower.

    That's how i deal with my streched ragdoll's neck
     
  23. Luteranos

    Luteranos

    Joined:
    Nov 2, 2015
    Posts:
    1
    @Nanako thanks man, some days later I have found your solution. So simple and the still the best aproach.
     
unityunity