Skip to content

Search

Terug
· 2 min leestijd

Soft bodies

Balaur devlog: softbody2d and softbody3d on Rapier, with cloth, rope, tearing, and a Physics panel that turns a mesh into a collider or a soft body.

softbody2d and softbody3d are bodies of particles held together by springs and elastic cells. Rapier simulates them on the fixed step, and the node is drawn from what it produced.

examples/cloth: a sheet draped over a block, and a ball tearing through a sheet pinned all round

  • kind lays the particles out: box, sphere, cloth, cloth_tube or rope in 3D, and grid, circle or rope in 2D. A mesh can be filled with cells or kept as a surface.
  • pinned_particles names the particles held in place. Past tear_strain or tear_force an edge breaks, and the node's on_tear runs.
  • The material rows set a spring per constraint family, the cell model and plasticity. solver = "fem" switches to Rapier's implicit step.
  • A soft body is in the snapshot, and the digest hashes every particle's velocity.
  • The Physics panel lists every physics component on the selection. One click turns a mesh into a hull, convex pieces, voxels or a soft body.
  • The node picker's rope2d, rope3d and cloth3d build pinned. A rope hangs from its first particle, and a 2 by 2 cloth from the two corners of one edge.
  • A 3D rope collides through segments and draws as a six-sided tube as wide as its particles.
  • regions gives parts of a body a material of their own: each lists its particles and sets stiffness_scale, tear_resistance, pinned, shape_matching or an edge spring. Each is a rapier cluster, so it rides the snapshot.
  • collision_mesh puts a mesh on the body that deforms with it, bound vertex by nearest particle, by index, or by the cell that holds it.

The rope3d and cloth3d presets: a rope swinging from its first particle, and a sheet hanging from two corners

The Physics panel on the disk of examples/jelly: the components it can add, and the soft body's rows by group

examples/jelly: a grid block over a peg, a disk under a box, a star, an arch and a rope bridge

[nodes.softbody2d]
kind = "circle"
radius = 1.0
particle_count = 32
color = [0.29, 0.56, 0.82, 1.0]

Weet je het zeker?