soft_body_anatomy
A rigid-body is a single moving frame: the position and the velocity of any of its points follow from one translation and one rotation. This is precisely what a deformable body can't be, because its parts must be able to move (somewhat) independently of each other. Instead, a soft-body is made of particles, aka. mass points, i.e., points without any orientation, each having 2 degrees of freedom in 2D and 3 in 3D. The more particles a body is made of, the more detailed its deformations can be, and the more expensive it is to simulate.
The particles are kept together by a lattice made of up to three kinds of elements:
- The particles are the only mandatory element, i.e., the positions the
SoftBodyBuilderis built from. They carry the mass and the velocity of the body. - The edges (
edges) connect two particles. The structural edges resist the stretching (and the compression) of the body, whereas the bending edges (bend_edges) and the dihedral constraints (dihedrals, 3D) resist its bending. - The cells (
cells) connect three particles in 2D (triangles) and four in 3D (tetrahedra). They resist the deformation of the area (2D) or of the volume (3D) they cover.
Two more concepts describe how the body interacts with the rest of the world. The surface
(surface) is the boundary of the body (segments in 2D, triangles in 3D): this is
what the body collides with, and what the preservation of its volume integrates over. A body without any surface, e.g.,
a cloud of particles, collides with nothing at all, unless it is given wire segments
(wire), in which case it collides as a polyline, which is what a 3D rope does.
Finally, a skin (skin) is a mesh which vertices follow the cells without being
particles themselves, as detailed in the skinning section.
Every element can be given manually to the soft-body builder, but the constructors of the next section build the lattices of the
most common shapes directly. The elements are given to these setters of the builder as NumPy arrays of particle indices, with one row per element (e.g., of shape (E, 2) for the edges and (C, 4) for the cells), or as sequences of tuples, and replace the elements generated by the constructor (see also add_edges). Note that the elements a body is made of decide which of the
cohesion models can hold it together.