# [No coding] Dynamic mesh components

Information
Step 1
In this lesson we'll continue from [Nocoding] Unity Basics with even more complex Components!
Step 2
Load your project/Scene from part 1 of this course. You should have a moving player.
Step 3
First we'll learn how to create cloth! Let's create a plane in the Hierarchy, rotate it so it's standing up.
Step 4
For moving mesh, we need to see the polygon wireframe of objects, so let's turn on selection wire from gizmos.

Every square or triangle you see on this means that, that part is moveable when turned into a cloth.

Step 5
Now for the main part! Add a cloth component to this plane object!
Step 6
Now we need to tell the cloth "What can touch it". Our player has a capsule collider. So let's enable that on cloth.

Increase capsule colliders size to 1 and then press ENTER to confirm.

• Elements = how many things can touch the cloth. (Size 3 = only 3 things can touch it)
Step 7
Element 0 is asking for an object that has a capsule collider, which is our player! Let's click n drag that into it.
Step 8
Let's see if this works... Click play and run into the cloth?

Uh oh, our cloth is also like a rigidbody, it has a gravity, but we still want gravity to affect it...

Step 9
To hang this cloth onto something, we need to constraint the top part of this cloth, kind of like a hanging curtain.

Click Edit constraints

Information
Step 10
Now we see all the poly's edges and points. A black dot means that it's free to move anywhere.
Step 11
Click on Paint. So we're going to click on points to make it "stuck" so that it doesn't move or fall.
• Black dots = Free to move
• Green dots = Stuck
Step 12
Let's click play and run into the cloth now!

It kind of works. The cloth moves slightly but it looks like we can't walk through it. Does it have a collider?

Ah there it is! Let's turn that off.

Step 13
Hit play and let's try again!

Hurray it works!

Challenge
Step 14
Small Shaders Challenge: Give the cloth a Material!
Information
Step 15
Next up, let's make our 3D model "Advanced", we'll have hair and clothes that actually floats in the air!

We are going to use this Dynamic bones script, download it and import it into your assets

Note: This script is made by Will Hong and it's only about 10% of the full package. If you want the full package, you can download it here to support him.

https://assetstore.unity.com/packages/tools/animation/dynamic-bone-16743

Step 16
Step 17
Depending on your 3D model, we need to group similar items together into an empty object.

If this shows up, just click Continue.

Remember to give it a title.

Step 18
If your character has hair that looks like it can really move, do the same thing for them.
Step 19
Click back your 3D model to get dynamic bones to show up again, Look for this box.
Step 20
Click and drag one of the empty objects that you created into this root box.
Step 21
If you have more than 1 empty object then you need 1 dynamic bone script for each part.

This is a big screen picture, it might be best to right click the image the open this image in a new tab to fully see it.

Step 22
Hit play and move around!

The hair is moving around like crazy! This is not what we want.

Step 23
Let's change Damping to 0.85 for all your parts. This smoothes the hair/skirt movement.
Step 24
Hit play to see if it flows smoothly!

It does flow smooth but something is still off.

Sometimes the skirt or the hair moves away from the body. Making it like it fell off of the body.

Step 25
So let's fix this! Change the stiffness to 0.85 for all your parts.
Step 26
Check it one more time by pressing Play.

Yay! The hair and skirt is now attached to the body!

NOTE: Your 3D model might be different and needs a bit more adjusting until it looks right.

[No coding] Dynamic mesh components Info

Account

MVCode Clubs

Created By

Course:

[No coding] Unity Intermediate

Access Level