How is a rope or a cloth sheet represented as particles and constraints in a position-based physics simulation?
answer
- point masses, not rigid pieces
- inverse mass on every particle
- edges become distance constraints
- diagonals for shear, skip-one for bending
- zero inverse mass pins a particle
basics
~20 sA rope or cloth is a set of point-mass particles joined by constraints: distance constraints along chain or grid edges, diagonals against shear, and longer-reach or angle constraints against bending; pinned particles get zero inverse mass.
solid answer
~40 sEach particle stores a position, a velocity (or its previous position) and an **inverse mass** `w = 1/m`. A rope is a chain of particles with a **distance constraint** between neighbours holding the rest length. A cloth sheet is a grid or triangle mesh: **structural** constraints along the edges resist stretch, **shear** constraints across quad diagonals resist skewing, and **bending** constraints resist folding, either as a distance constraint that skips one particle or as a dihedral-angle constraint across two triangles sharing an edge. Attachment points, such as a cape's shoulder particles or a rope bridge's anchors at the cliff edge, get `w = 0`: constraint projection never moves them, and gameplay or animation places them each step. Particles have no orientation or inertia tensor; the solver only ever moves positions.
go deeper
Recall the parts: particles with position, velocity and inverse mass, and distance constraints along edges, diagonals and skip-one pairs. Know that zero inverse mass pins a particle.
Explain what each constraint family resists and what the cloth looks like without it, and why a skip-one bending constraint also resists stretch while a dihedral one does not.
Show you pick resolution and constraint sets for the camera: coarser cloth converges faster, attachments are driven by animation, and finer meshes need more solver work to stay unstretched.
Frame the representation as a budget: particle count, constraint families and attachment style per asset class, chosen so artists get the look while the solver cost stays predictable.
## Particles are the only state A position-based deformable is not one object with a shape. It is a cloud of **particles**, each a point mass, and a list of **constraints** that say how those particles must sit relative to each other. Each particle stores: - a **position** `x`, and during a step a **predicted position** `p`; - a **velocity** `v`, or the previous position from which velocity is recovered; - an **inverse mass** `w = 1/m`, used to share each correction between the particles a constraint touches. There is no orientation, no angular velocity and no inertia tensor per particle. Everything that looks like rotation, such as a cape swinging round a shoulder, emerges from many particles moving together. That is what makes the representation cheap: a step touches only positions. Particle mass usually comes from the cloth's area density: each particle takes a share of the area of the triangles around it. Uneven masses are allowed, because the inverse-mass weighting already handles them. ## Constraints are rules on positions A constraint is a function `C(p1, p2, ...)` of some particles' positions that is zero (an equality) or non-negative (an inequality) when the rule holds. The solver moves the particles until the rule holds, or holds as nearly as its iterations allow. | Constraint | Particles | What it resists | |---|---|---| | **Structural** distance | the two ends of a mesh edge | stretching along the weave | | **Shear** distance | the two ends of a quad diagonal | skewing a square into a diamond | | **Bending** (skip-one distance) | particles two edges apart | folding, coupled with stretch | | **Bending** (dihedral angle) | the four particles of two triangles sharing an edge | folding, independent of stretch | | **Collision** (inequality) | one particle and a collider surface | passing into a body or the floor | A distance constraint is `C = |p1 - p2| - L`, with `L` the rest length. The skip-one bending constraint is just a distance constraint between non-neighbours, which is simple but also resists stretch; the dihedral-angle constraint measures the angle between the two triangles' normals, so bending and stretching can be tuned separately. ## A rope as a particle chain A rope is the one-dimensional case: particles in a line, with a distance constraint between each neighbouring pair. For a rope bridge: 1. Build each hand rope and the walkway ropes as chains, with particle spacing chosen from the look you need. 2. Give the particles at each cliff anchor `w = 0`, so they never move. 3. Add a skip-one distance constraint along the chain if the rope should resist kinking; leave it out for slack, floppy rope. 4. Connect the planks to the walkway rope particles with more distance constraints, or treat each plank's corners as particles. A chain only resists stretch; it has no twist. If twist matters, which is rare for a bridge, you need a richer model, such as rigid segments with orientation. For most game ropes, positions alone are enough. ## A cloth sheet as a grid or mesh A cloth sheet is the two-dimensional case. On a regular grid you add structural constraints on every row and column edge, shear constraints on both diagonals of each quad, and bending constraints. A triangle mesh from an artist uses its edges as structural constraints and pairs of adjacent triangles for bending. Missing constraint families show up immediately: - no shear constraints: the cloth skews and slides like a loose net; - no bending constraints: folding is free, so it crumples into sharp creases like wet tissue; - too-stiff bending: it moves like cardboard. ## Pinning and attachment **Pinning** a particle means setting its inverse mass to zero. Every projection splits its correction in proportion to `w`, so a particle with `w = 0` takes none of it, and the free particles take all of it. Gameplay or animation then writes the pinned particle's position directly each step: a cape's shoulder row follows the character's skeleton, and a flag's pole edge stays on the pole. A very large mass is a poor substitute, because the particle still drifts slightly and the mass ratio slows convergence. ## Choosing a resolution More particles give finer folds but cost more, and they change behaviour too. At a fixed iteration count a finer mesh is **stretchier**, because each iteration spreads corrections across only a limited part of the mesh, so a long chain or a large sheet converges more slowly. Ropes and cloth are therefore built at the coarsest resolution that still reads well at the camera distance where they are seen.
- Why not simulate a rope as a chain of small rigid bodies linked by joints?You can, and it pays off when each link's own rotation or twist matters. Particles carry only positions, so each link costs far less and the whole chain is solved with the same simple position projection as cloth. Rigid links add orientation, inertia and a joint constraint per link for detail most game ropes never show.
- What happens if a cloth grid has structural edge constraints but no bending or shear constraints?Stretch along the edges is resisted, but nothing resists the quads skewing into diamonds or the sheet folding along any edge. The cloth slides like a loose net and crumples into sharp creases, because a fold changes no edge length and so costs nothing.
- Each cloth particle needs an orientation and an inertia tensor.
- A pinned particle needs a huge mass, because zero inverse mass breaks the math.
- Edge distance constraints alone are enough to make cloth look like fabric.
- A rope can only be simulated as rigid bodies connected by joints.
- Adding more particles makes cloth stiffer at the same iteration count.