Search Unity

How to make realistic dynamic ponytail?

Discussion in 'Physics' started by LaurynasLubys, Aug 28, 2016.

  1. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    Hello.
    I am trying to create ponytail for my character.
    Ponytail consists of 5 bones, not animated with ponytail mesh skinned.

    I used rigid bodies, sphere colliders and character joints. First character joint is attached to head rigid-body, second to first ponytail joint rigid-body and so on.

    My problem is that ponytail bounces, jiggles and stretches extremely bad. Video showing this is bellow:


    What options should I change or add to make it as realistic as possible?
    (Haven't used any coding for this yet)

    Thank you in advance!
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    Hair is hard! If I were you, I'd look for something free/cheap on the asset store.

    You could also try to see if using cloth physics instead of joints could be an option.
     
  3. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    I want to make everything myself from scratch.
    Do you think that using only Unity physics or prefabs like rigidbody,. character joints and colliders will never give a good result?

    Currently it is like this. I think it is a bit better. I added "spring" and "contact distance" some values in character joint (they were set to 0 originally).

     
  4. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    Why does hair detaches from the connected node like it is attached with weak spring?
    If I would use such e.g. in a vehicle for doors, my doors would be flying in air chasing car!


    Solved my specific case by removing first character joint, and moving it into parent (head).
    Now I need to solve this jerkiness.
     
    Last edited: Aug 29, 2016
  5. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    It is much better now. Only one collider tough, but the more there are the more jittery chain of joints will appear.

    I think whats left to do is to make hair heaver, react to gravity more. Anyone knows how to do that?
    Changing mass of rigid body won't give correct result.

     
    ChrisSch likes this.
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    If you want it to react to gravity more, you can just apply extra gravity (ie. down force) in FixedUpdate. Not sure if that'll work very well, but you could see.

    There's apparently also somebody that's working on making HairWorks work with Unity. Here's the thread. And here's the github.'

    Hairworks is what's used for the hair in eg. the Witcher 3.
     
    ChrisSch likes this.
  7. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    Hair works fine now, but I am experiencing another big problem.
    Whenever I add rigid-body to my skeleton hair becomes extremely jerky.



    I have created ragdoll for this character, and it does not work at all with dynamic hair (rigid bodies, colliders and character connections)
     
  8. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I'm putting together a ponytail demo for UMA, and seeing the same hair weirdness. Did you end up using a CharacterJoint? If so, what settings did you end up using? My ponytail is waving around like an octopuses arms.
     
  9. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    I didn't fix it. However, I pushed it to something less buggy, by making only a single collier on the pony tail (one collider on one of the chain of bones in the ponytail). I also discovered that hair will become extremely jerky if at least one of the rigid-bodies in the body will have gravity enabled - seems like a bug to me. And yes I'm using character joints, and one single fixed joint where the ponytail connects to the head. Even if the first bone of the ponytail is the child of the head, I experience ponytail extremely jittery without this fixed joint (which does not hing in theory).

    I added picture to explain better. Pony_tail_skeleton_1 - fixed joint to the head, the rest is character joints to parent bones in the ponytail.
     

    Attached Files:

    • Hair.jpg
      Hair.jpg
      File size:
      248.8 KB
      Views:
      1,234
  10. LT23Live

    LT23Live

    Joined:
    Jul 8, 2014
    Posts:
    97
    So how did this turn out now?
    Were you able to make this style work with more dynamic types of hair?
     
  11. LaurynasLubys

    LaurynasLubys

    Joined:
    Mar 7, 2012
    Posts:
    80
    It works like this now, don't mind the rest:


    It works ok, and by ok I mean not perfect.
    It floats a bit too much, especially while running. I might work on it later and try to fix it.