[No coding] Dynamic mesh components

Step 1
In this lesson we'll continue from [Nocoding] Unity Basics with even more complex Components!
Temp1544994392
Step 2
Load your project/Scene from part 1 of this course. You should have a moving player.
Temp1544994546
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.
Temp1544994668 Temp1544994725
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!
Temp1544995297
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.
Check Your Work
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.
Temp1544996608

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.
Temp1544996693
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.
Temp1545002035 Temp1545002120
  • 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?

Temp1545003008

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

Temp1545003094
Check Your Work
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

Temp1545005132 Download DynamicBone.cs

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
So let's now add the dynamic bone script to your character.
Step 17
Depending on your 3D model, we need to group similar items together into an empty object.
Temp1545006315

If this shows up, just click Continue.

Temp1545006388

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.
Temp1545006664
Step 19
Click back your 3D model to get dynamic bones to show up again, Look for this box.
Temp1545006961
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.
Temp1545007267 Temp1545007314

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.

Check Your Work
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.
Temp1545007769
Check Your Work
Step 24
Hit play to see if it flows smoothly!

It does flow smooth but something is still off.

Temp1545008018

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.
Temp1545008077
Check Your Work
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

Nepgear tina (instructor)

Course:

[No coding] Unity Intermediate

Access Level

premium

For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach