A description over raw world-space particle positions (flattened), with no element: add edges, cells and a surface with the setters.
Optional positions: number[] | Float32ArrayExtra internal PGS iterations per substep for the body and everything it touches.
Extra solver substeps requested for the body and everything it touches.
Whether the body may fall asleep.
The constitutive model of the cells.
The dominance group of the body.
Private generatorGravity scale of the particles.
Linear damping of the particles.
The total mass of the body, spread over its particles, or null to use particleMass.
Per-particle masses, or null for uniform masses.
The material of the soft body, or null to keep the default one (with softness
applied on top when set).
Whether the shape of the body's collision surface is built with the ORIENTED flag
(null: whenever the surface is closed).
The uniform mass of the particles (ignored when masses is set).
The thickness of the particles (null: what the generator chose).
The indices of the pinned particles.
Whether the body's surface collides with itself.
Private settersWhether shape matching holds the body's shape (null: what the generator chose, off for
raw positions).
Whether the body collides through its skin rather than through its cells' boundary.
A uniform softness applied to every constraint of the material, or null.
The solver holding the cells together.
The template of the body's colliders (their shape is replaced by the body's deformable
surface), or null for a body without collisions.
A translation applied to every particle.
Optional userAn arbitrary user-defined object associated with the soft body.
The target volume multiplier of the volume preservation (> 1 inflates the body).
Whether the area/volume enclosed by the body's closed surfaces is preserved (null:
what the generator chose, off for raw positions).
Static Private withAdds structural edges (flattened particle pairs).
Appends the particles and elements of another description to this one.
Sets the extra internal PGS iterations per substep for the body and everything it
touches (default: 3).
Sets the extra solver substeps requested for the body and everything it touches.
Replaces the bending edges (flattened particle pairs).
Sets whether the body may fall asleep.
Sets the constitutive model of the cells.
Replaces the cells (flattened triangles in 2D, tetrahedra in 3D).
Replaces the dihedral bending constraints (flattened quadruplets: the shared edge, then the two opposite vertices).
Sets the dominance group of the body.
Overrides the softness of the given edges.
Multiplies the tear thresholds of the given edges.
Replaces the structural edges (flattened particle pairs).
Sets the gravity scale of the particles.
Sets the linear damping of the particles.
Sets the total mass of the body, spread over its particles.
Sets per-particle masses.
Sets the material of the soft body.
Removes the body's colliders: it will not collide with anything.
Sets whether the shape of the body's collision surface is built with the ORIENTED
flag, like a polyline or mesh. Left unset, it is whenever the surface is closed, which
is what a solid body wants: an oriented closed surface encloses matter, so nothing is
held inside it. Set it to false for a shell, whose inner side holds the bodies inside
it.
Sets the uniform mass of the particles.
Sets the thickness of the particles.
Pins the given particles in place.
Makes the body's surface collide with itself.
Holds the body's shape by shape matching.
Sets a skin: a finer mesh (flattened world-space vertices and elements) embedded in the cells, which follows them.
Makes the body collide through its skin rather than through its cells' boundary.
Sets a uniform softness for every constraint of the material.
Sets the solver holding the cells together (SoftBodySolver.Fem needs cells).
Replaces the boundary elements (flattened segments in 2D, triangles in 3D), oriented outward.
Sets the template of the body's colliders: its friction, restitution, groups, events and other settings are kept, its shape is replaced by the body's deformable surface.
Makes every edge resist stretching only (a rope or a net that folds freely).
Translates every particle.
Sets the user data associated with the soft body.
Sets the target volume multiplier (> 1 inflates the body); this also enables the
volume preservation.
Enables the preservation of the area/volume enclosed by the body's closed surfaces.
Sets the segments a body without surface collides through (a wire).
Static clothA cloth of nu by nv particles: particle (i, j) is at origin + i * du + j * dv.
Static clothA cloth with different softness along du (warp), along dv (weft) and across the
diagonals (shear).
Static clothA tube of cloth around axis, from radiusStart at origin to radiusEnd at its
other end, with numAround particles per ring and numAlong rings.
Static cuboidA box of nx by ny by nz particles filled with tetrahedral cells.
Static ropeA rope of numParticles particles from start to end.
Static sphereA hollow sphere: an icosphere surface with subdivisions refinement levels, holding
its volume (a balloon).
Static trimeshA triangle-mesh body without cells: the vertices are particles, the triangles the
surface, held by dihedral bending and shape matching. Returns null if the mesh is
empty.
Static volumetricA body filling the closed surface (segments in 2D, triangles in 3D) with cells of the
given size; skinned keeps the surface as a skin embedded in the cells. Returns
null if the surface cannot be meshed.
The flattened world-space vertices of the surface.
The flattened elements of the surface.
Optional skinned: boolean
The description of a soft body to create.
Start from one of the generators (
SoftBodyDesc.rope,cloth,cuboid,sphere,trimesh,volumetricin 3D;rope,polygon,disk,grid,polyline,volumetricin 2D) or from raw particle positions, then tune it with the chainable setters. The description holds no WASM memory: it is applied when the soft body is created.