All examples · Experiments

Cloth

What this example shows

Move the mouse over it to poke it, click and drag to grab it (pull too hard and the threads snap), shift and drag to cut it, and press R to hang a new one.

No physics engine: Verlet integration (a point's speed is where it is minus where it was) and springs relaxed a few times per step, in the example's own code. The step is fixed, 1/60 of a second, whatever the frame rate does.

The engine draws it with useHelperLines, rewritten every frame, and screenToRay turns the mouse into a point on the cloth's plane through the camera. Each thread goes from white to red as it nears snapping.

Starting