Fabric
Cloth is a special component that can be changed to any shape, such as flags and curtains that follow the wind.
There are two ways to create a cloth: Create a cloth object and add a cloth component to the game object. The former selects create -- cloth in hierarchy view. After the creation, the system automatically adds the interactive cloth component (Interactive clothe) and cloth Rendering component (cloth Renderer) to the object. The latter is to select the component -- physics -- Interactive cloth menu item in the navigation menu.
The interactive fabric component is a fabric composed of grids. It can be used only for logical determination of the fabric. It can be used for friction, density, pressure, and other factors that affect the fabric effect and determine the physical value of the fabric.
Cloth rendering is to draw a texture for the cloth to make it more beautiful.
Skinned cloth is a cloth used to simulate the skin of a person's model, such as clothes and trousers. The fabric changes based on the movement of the role's skeleton animation.
Bending Stiffness: hardness. Value: 0-1.
Stretching stiffness: toughness, value: 0-1.
Damping: resistance. Value: 0-1.
Thickness: thickness, which directly affects the quality of the fabric.
User gravity: Only gravity is used.
Self collision: Self collision.
External acceleration: an external force acting on the fabric, affecting the default behavior of the fabric.
Random acceleration: Random external force.
Mesh: mesh surface, which determines the shape of the fabric.
Friction: friction. Value: 0-1.
Density: density. The larger the value, the higher the quality of the fabric.
Pressure: pressure.
Collision Response: feedback after collision with other models.
Attachment tear factor: includes the tear factor.
Attachment response: with feedback.
Tear factor: Tear coefficient. The larger the value, the more difficult it is to tear.
Attached colcyclers: With a collision tool.
This article will summarize and review a cloth instance. You can click the button on the left to control the movement direction of the plane object. Because it will collide with the cube, the cloth will be deformed.
Using unityengine; using system. collections; public class script_06_12: monobehaviour {// cloth object cloth = NULL; void start () {// obtain the cloth object cloth = (cloth) getcomponent <interactivecloth> ();} void ongui () {// move the cloth if (guilayout. repeatbutton ("up") {cloth. externalacceleration = new vector3 (0, 1, 0);} If (guilayout. repeatbutton ("down") {cloth. externalacceleration = new vector3 (0,-1, 0);} If (guilayout. repeatbutton ("Left") {cloth. externalacceleration = new vector3 (1, 0, 0);} If (guilayout. repeatbutton ("right") {cloth. externalacceleration = new vector3 (-, 0 );}}}
Run:
Click the button: