Version: 2021.1
Spring Joint
Wheel Collider

Cloth

The Cloth component works with the Skinned Mesh Renderer to provide a physics-based solution for simulating fabrics. It is specifically designed for character clothing, and only works with skinned meshes. If you add a Cloth component to a non-skinned Mesh, Unity removes the non-skinned Mesh and adds a skinned Mesh.

To attach a Cloth component to a skinned Mesh, select the GameObject in the Editor, click the Add Component button in the Inspector window, and select Physics > Cloth. The component appears in the Inspector.

Propiedades

Propiedad Función
Rigidez del estiramiento de la tela. Rigidez del estiramiento de la tela.
Rigidez de flexión de la tela. Rigidez de flexión de la tela.
Use Tethers Aplica restricciones que ayudan prevenir el movimiento de partículas de la tela de irse muy lejos de las que están fijas. Esto ayuda reducir el exceso de estiramiento.
Use Gravity Debería la aceleración gravitacional ser aplicada a la tela?
Damping Coeficiente de amortiguación del movimiento.
External Acceleration Una constante, aceleración externa en ser aplicada a la tela.
Random Acceleration Una aceleración aleatoria, externa, aplicada a la tela.
World Velocity Scale Qué tanto movimiento del personaje en el espacio del mundo afectará los vértices de la tela.
World Acceleration Scale Qué tanta aceleración del personaje en el espacio del mundo será afectada por las vértices de la tela.
Friction La fricción de la tela cuando colisiona con el personaje.
Collision Mass Scale Qué tanto aumentar la masa de las partículas en colisión.
Use Continuous Collision Permite la colisión continua para mejorará la estabilidad de colisión.
Use Virtual Particles Agrega una partícula virtual por triángulo para mejorará la estabilidad de colisión.
Solver Frequency Número de iteraciones del solucionador por segundo.
El umbral del adormecimiento de la tela. El umbral del adormecimiento de la tela.
Capsule Colliders Un arreglo de CapsuleColliders el cual esta instancia de Cloth (Tela) debería colisionar con.
Sphere Colliders Un arreglo de ClothSphereColliderPairs el cual esta instancia de Cloth (Tela) debería colisionar con.

Detalles

El Cloth (Tela) no reacciona a todos los colliders en la escena, ni tampoco aplica fuerzas devuelta al mundo. Cuando ha sido agregado, el componente Cloth no va a reaccionar a o influenciar otros cuerpos en absoluto. Por lo tanto el Cloth (Tela) y el mundo no se reconocen o se ven el uno al otro hasta que usted manualmente agregue colliders del mundo al componente Cloth. Incluso, después de eso, la simulación todavía es de una manera: Cloth (tela) reacciona a estos cuerpos pero no aplica fuerzas devuelta.

Adicionalmente, usted puede únicamente utilizar tres tipos de colliders con la tela: un sphere (esfera), un capsule (cápsula), y capsule colliders cónicos, construido con dos sphere colliders. Estas restricciones existen para mejorar el rendimiento.

Edit Constraints Tool

You can apply constraints to specific vertices of the cloth to give them more or less freedom of movement.

In the Inspector, select Edit cloth constraints (top-left button) in the Cloth component. When the tool is active, small spheres appear in the Scene view on all vertices of the mesh. They represent the cloth particles to which you can apply constraints. The Cloth Constraints tool window also appears at the bottom right of the Scene view.

La Cloth Constraints Tool siendo utilizada en el Skinned Mesh Renderer.
La Cloth Constraints Tool siendo utilizada en el Skinned Mesh Renderer.

Constraint types and colors

For each cloth particle, you can set and display two types of constraints: * Max Distance – the maximum distance a cloth particle can travel from its vertex position. * Surface Penetration – how deep the cloth particle can penetrate the mesh.

The color of a particle represents the relative value of its constraint within the cloth, according to the type of constraint currently selected.

Constraints visualization

The visualization properties of the Cloth Constraints Tool.
The visualization properties of the Cloth Constraints Tool.
Propiedad Función
Visualization Allows you to select which constraint type and which particles to display.
Max Distance Displays only the Max Distance values of the cloth particles.
Surface Penetration Displays only the Surface Penetration values of the cloth particles.
Manipulate Backfaces Enable this option to visualize and manipulate particles that might be hidden behind the current facing part of the cloth.
[ Color spectrum ] Provides the correspondance between particle colors and constraint values for the above selected constraint type, according to the mimimum and maximum values currently applied within the whole cloth. Black always means that the particle has no constraint.
Constraint Size The display size of the spheres that represent the cloth particles. Adjust this value at your convenience to ease your constraints edition. This property has no effect on the constraints themselves.

Constraints edition modes

You can use 3 different modes to edit the cloth constraint values.

Mode Description
Select Allows you to apply a fixed constraint value to a pre-selected group of particles.
Paint Allows you to apply a fixed constraint value by painting the cloth particles with a brush.
Gradient Allows to apply a left-to-right linear gradient of constraint values to a pre-selected group of particles.

The tool properties and the steps that you need to perform are different according to the mode you are using. In all cases, the last step corresponds to the action that applies the constraint values.

With the Select mode:

The Cloth Constraints Tool in Select mode.

  1. Use the mouse cursor to draw a selection box or click on particles one at a time.
  2. Enable the constraint type that you want to apply to your selection: Max Distance, Surface Penetration, or both.
  3. Set a value according to the constraint type you just enabled.
With the Paint mode:

The Cloth Constraints Tool in Paint mode.

  1. Adjust the Brush Radius according to the area you need to cover with the brush.
  2. Enable the constraint type you want to apply: Max Distance, Surface Penetration, or both.
  3. Set a paint value according to the constraint type you just enabled.
  4. Paint the constraints on the particles with the brush.
With the Gradient mode:

The Cloth Constraints Tool in Gradient mode.

  1. Ensure to toggle on the 2D view in the Scene view (the tool cannot apply a gradient when in 3D view).
  2. Use the mouse cursor to draw a selection box or click on particles one at a time.
  3. Set the limit values of the gradient you want to apply left-to-right within your selection: Gradient Start and Gradient End.
  4. Enable the constraint type that you want to apply to your selection: Max Distance, Surface Penetration, or both.

Self collision and intercollision

Cloth collision makes character clothing and other fabrics in your game move more realistically. In Unity, a cloth has several cloth particles that handle collision. You can set up cloth particles for:

  • Self-collision, which prevents cloth from penetrating itself.
  • Intercollision, which allows cloth particles to collide with each other.

To set up the collision particles for a cloth, select the Self Collision and Intercollision button in the Cloth inspector:

The Self Collision and Intercollision button in the Cloth Inspector
The Self Collision and Intercollision button in the Cloth Inspector

The Cloth Self Collision And Intercollision window appears in the Scene view:

The Cloth Self Collision And Intercollision window
The Cloth Self Collision And Intercollision window

Cloth particles appear automatically for skinned Meshes with a Cloth component. Initially, none of the cloth particles are set to use collision. These unused particles appear black:

Unused cloth particles
Unused cloth particles

To apply self-collision or intercollision, you need to select a single set of particles to apply collision to. To select a set of particles for collision, click the Select button:

Select cloth particles button
Select cloth particles button

Now left-click and drag to select the particles you want to apply collision to:

Selecting cloth particles using click and drag
Selecting cloth particles using click and drag

The selected particles appear in blue:

Selected cloth particles are blue
Selected cloth particles are blue

Tick the Self Collision and Intercollision checkbox to apply collision to the selected particles:

Self Collision and Intercollision tick box
Self Collision and Intercollision tick box

The particles you specify for use in collision appear in green:

Selected particles are green
Selected particles are green

To enable the self collision behavior for a cloth, to go the Self Collision section of the Cloth Inspector window and set Distance and Stiffness to non-zero values:

Self Collision parameters
Self Collision parameters
Propiedad: Función:
Distance The diameter of a sphere around each particle. Unity ensures that these spheres do not overlap during simulations. Distance should be smaller than the smallest distance between two particles in the configuration. If the distance is larger, self collision may violate some distance constraints and result in jittering.
Stiffness How strong the separating impulse between particles should be. The cloth solver calculates this and it should be enough to keep the particles separated.

Self collision and intercollision can take a significant amount of the overall simulation time. Consider keeping the collision distance small and using self collision indices to reduce the number of particles that collide with each other.

Self collision uses vertices, not triangles, so don’t expect self collision to work perfectly for Meshes with triangles much larger than the cloth thickness.

Paint and Erase modes allow you to add or remove particles for use in collision by holding the left mouse button down and dragging individual cloth particles:

Self Collision parameters
Self Collision parameters

When in Paint or Erase mode, particles specified for collision are green, unspecified particles are black, and particles underneath the brush are blue:

Particles being painted are blue
Particles being painted are blue

Cloth intercollision

You specify particles for intercollision in the same way as you specify particles for self collision, as described above. As with self collision, you specify one set of particles for intercollision.

To enable intercollision behavior, open the Physics settings (from the main menu in Unity: Edit > Project Settings, then select the Physics category) and set Distance and Stiffness to non-zero values in the Cloth InterCollision section:

Enable intercollision behavior in the Physics settings
Enable intercollision behavior in the Physics settings

Cloth intercollision Distance and Stiffness properties have the same function as self collision Distance and Stiffness properties, which are described above.

Collider collision

El Cloth no es capaz de simplemente colisionar con geometría arbitraría del mundo, y ahora solo va a interactuar con colliders especificados ya sea en el los arreglos Capsule Colliders o Sphere Colliders .

El arreglo de los sphere colliders puede contener ya sea una sola SphereCollider instancia válida (con la segunda siendo nula), o un par. En los primeros casos el ClothSphereColliderPair solamente representa un solo sphere collider para que la tela colisione. En el último caso, este representa una forma de cápsula cónica definida por las dos esferas, y el cono conectando ambas. Las formas de cápsula cónicas son útiles para modelar extremidades de un personaje.


  • 2017–12–05 Page amended

  • Cloth self collision and intercollision added in 2017.3 NewIn20173

Spring Joint
Wheel Collider