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:

Cloth

This, however, is not enough for an accurate simulation. If we set any one ...

Get Game Physics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.