Using cloth
In this recipe, we will create a simple cloth simulation:
Cloth simulation used to create a flag
Getting ready
For this recipe, we need a model of the cloth. It should be a plane divided several times to have enough vertices for the cloth simulation to work. In our example, we use one additional model: the flag pole. You can go to the Chapter 09 Physics and animations\Recipe 01 Using cloth
directory. You will find a FlagPole
game object in the Example.unity
scene there. This object contains the Flag
and the FlagPole
objects as children. The Flag
game object uses the cloth simulation.
How to do it...
To use cloth simulation, follow these steps:
- Place the
Flag
game object in the scene. - Add the
Cloth
component to theFlag
game object (go toComponent
|Physics
|Cloth
).
- Notice that a
Skinned Mesh Renderer
component is automatically added. You may remove theMesh Renderer
component from the object. - Find the mesh of the
Flag
and drag it to theMesh
field in theSkinned Mesh Renderer
component...