Cloth
We can use springs to model interesting soft body objects. Unlike a rigidbody, a soft body can change its shape. In this section, we will use springs to simulate cloth. Cloth is implemented as a point mass system. In a point mass system, every vertex of a mesh is represented by a particle. Every particle is attached to other particles by springs to force the object to maintain its shape.
If we arrange all the particles representing the vertices of a cloth in a grid, we can connect every row and column using springs. These springs are the structural springs of the cloth:
This, however, is not enough for an accurate simulation. If we set any one of the particles to have infinite mass so that it does not move, the cloth will collapse into a rope. We can improve the structural integrity of the cloth by adding shear springs. Shear springs connect every particle to its neighbors diagonally:
Having both structural and shear springs makes the cloth behave as expected in the scenario where one...