imagination XD

realizing dream

Joint-based Hair / Cloth Physics for Unity


I was doing the MMD4Unity research. I do this because, on Google, if you want a Hair Physics, you have to wrote a script, or key frame it naturally in your model. Ain’t nobody got time for that keyframing! So, this might be very useful for easy Joint-based hair / cloth physics, even wrote a script was useful too.

Okay, so it’ll be like this. It could be very awesomely epic if you are not lazy to set the character joint setting.

“It’s long and complicated, i better use keyframe method.” Yeah true, but what to do when the hair colliding object because of your keyframing method ?

Let’s get Neru Akita as example (Model from MMD, some motion from Unity-chan).

Unity 2014-07-27 14-07-06-60_2

1. Now Select cloth / hair bones and then add Capsule Collider like the picture below.

2. After that, adjust the size of the colliders and then add Character Joint.

3. If your character has a Character Controller on it / Playable, Open Tags & Layer, add 2 layers. Set ‘Player’ layer to object that has Character Controller on it. Else, set the object that you want to have a hair / cloth physics like Hair Bones1, Hair Bones2, and so on, or Hair/Cloth physics collider like MidSpine (That has Collider, so hair / cloth wont clip like hell). Basically, Just set Cloth Layer to Skinned Mesh Renderer, and set it to all children.
3b (Bones)

4. Go to your character controller script. Whatever script is OK as long as its located on Object that has Character Controller on it. Don’t make a new script. Just add this line to function Start() or void Start(). Works on both C# and JS. 8 is Cloth layer, 9 is Player layer. it’s all up to you on what layer you set the Cloth or Player layer. If you set cloth layer to 10, then write 10.


3c (bones)
5. Alright now let’s add Rigidbody on cloth’s / hair’s root bone. For the root of the cloth (like this below), turn on isKinematic and turn off useGravity. Root doesn’t need a Character Joint, Collider is optional.

4 (bones)
6. Now set the Character Joint’s connected body. For instance, 1 (Cloth Root), 2 (1’s child), 3 (2’s child). 3’s connected body is 2, 2’s connected body is 1, and 1 doesn’t have a Character Joint. Like the picture below.
5 (bones)
7. Set bone’s swing limit, spring, high twist limit, low twist limit that suits to your model.
6 (bones)
8. Now add some collider to body that Hair or cloth will collide. Remember to set the body layer to CLOTH, so your character controller wont collide it. I add the colliders on Body, Hands, and Head.
7 (bones)

Because if you don’t add colliders, it’ll look like this:
Unity 2014-07-27 14-07-06-60

Now look! A cloths dynamic! It much better than the method I use on Wild West Showdown (Skinned Cloth). Look at her front hair and tie.
Unity 2014-07-27 14-07-06-60_1


As I said, I leave making games because I need to level up my CG level. I said I was give up right ? No, and never. I just need to learn to make a better CG Artwork. I’m currently making a mascot model for Imagination, named Imajine-chan. but, I don’t have an inspiration for her character design.

If you have something to ask, don’t hesitate to comment, I’ll reply it fast.

EDIT : “My Character raycast’s script is broken because of this.” Well, you could replace Cloth to IgnoreRaycast layer.



Started making games since 13 year old. 3D CGI Weeaboo | VFX Otaku | Anime Researcher | Indie Game Dev | VR Chuunibyou

8 thoughts on “Joint-based Hair / Cloth Physics for Unity

  1. Nice tutorial of jigglebone! :P
    for me, i dont use collider and i use detached bone from parent at start(). Looks ok but i think yours is more better

  2. Hi!
    Can I ask how would you do a long flowing skirt or a robe? I know Unity has two options for it (SkinnedCloth and DynamicCloth) but the documentation is a bit too generalistic.

    • Well, you have to make a long and a lot of joints in every segments.

      Like, Skirt1 > Skirt1.1 > Skirt1.2 > Skirt1.3 > and so on.

      I don’t really want to use skinnedcloth, because it’s not really good / laggy sometimes.

  3. Is it supposed to work with any character? because i’m trying to do it but the hair won’t follow the character dynamically, it moves with it but not simulates physics.

    • Yeah it works on any character. You probably didn’t make some collider in your character. Or maybe your collider was ignored by your hair rigidbody, check your rigidbody ignore collision

  4. Hi,

    I am working on cloth simulation on a human model and using Unity. My issue is since the new Cloth has only sphere, cone and capsule colliders, it is difficult for me to add it dynamically to the body. Can you suggest a way to add mesh collider on the body more or less close to its shape. As I am more focussed on fitting of cloth on the body, sphere colliders won’t work. Will I need Unity shaders for this?


    • I’m not sure, but the point of putting those primitive colliders are so it doesn’t slow down performance much.
      And also you can put those on every joints, which Mesh collider wont.

      If you prefer use Mesh collider, just use cloth renderer, it’s kinda heavy, but yeah


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s