Skip to main content

Cloth

Cloth turns a Plane into fabric: it hangs from the edge you pin, sways when its object moves, flaps in a Wind Zone and drapes over the objects you give it. Use it for flags, banners, capes, curtains, sails and tablecloths. It works like Unity's Cloth component.

A flag in a Wind Zone, a curtain a ball pushes through, a tablecloth over a table and vase, a banner on a moving cart
A flag in a Wind Zone, a curtain a ball pushes through, a tablecloth over a table and vase, a banner on a moving cart

Add cloth​

  1. + Add → Plane.
  2. To make a standing flag or curtain, set the plane's Rotation X to 90. Its top edge is then up. A plane lying flat (a tablecloth) stays at 0.
  3. Add component → Cloth.

Press ▶ Play. The cloth only moves while the game runs. In the editor it shows as a flat plane.

The plane's Scale is the size of the cloth: X is its width and Z its height (or length when it lies flat). Cloth only works on a Plane shape. On any other shape the card shows ⚠ and nothing moves.

Settings​

SettingWhat it does
ResolutionSquares along each side (2 to 48). More squares fold more smoothly but cost more. 16 suits most flags; use 10 or less for many small cloths on phones.
PinnedWhich points stay fixed to the object: Top edge (curtains, banners), Left edge (a flag on a pole), Bottom / Right edge, Top corners (a hanging sheet), All corners (a hammock or awning), or None (a sheet that falls and drapes).
Stretching Stiffness0 to 1: how much it resists stretching. Keep it at 1 for fabric; lower values make it rubbery.
Bending Stiffness0 to 1: how much it resists folding. Low drapes like silk, high holds out like canvas.
Damping0 to 1: how quickly movement dies down.
Use GravityPulled down by the scene's gravity.
External AccelerationA steady push on every point, in m/s² (world X, Y, Z). For example, a breeze that never stops without a Wind Zone.
Random AccelerationA random push up to this much per axis each step: flutter.
Wind ScaleHow strongly Wind Zones blow it. 0 ignores them. Wind pushes hardest on a cloth that faces it; edge-on, it barely moves.
World Velocity Scale0 to 1: how much the cloth trails behind when its object moves. 0 moves with it as if it were stiff, 1 lags like real fabric (a cape on a running character, a banner on a cart).
Friction0 to 1: how much a point loses its slide on a collider. High keeps a tablecloth from sliding off.
Solver Iterations1 to 10: how many times each step the springs are pulled straight. More is stiffer and costs more.
CollidersObjects the cloth stays out of. Use objects with a sphere, capsule or box collider (an Auto collider on a sphere, capsule, box or cylinder shape works too).
card cloth

Things to know​

  • The cloth only reacts. Bodies don't feel it: a ball pushes a curtain aside, but the curtain doesn't slow the ball.
  • It doesn't collide with itself or with the ground. Give it a box collider object if it should rest on something.
  • Put a cloth on a child of a moving object to carry it along: a cape on a character, a flag on a ship. Pin the edge that touches the object.
  • Changing Resolution or Pinned while the game runs starts that cloth again.
  • Each cloth costs about 0.5 ms a frame at Resolution 16 on a laptop. On phones keep to a few cloths, or lower their resolution.

Events and scripts​

  • Reset cloth (Effects) puts the cloth back on its plane, hanging still. In scripts, use entity.resetCloth().
  • Scripts can change every setting while the game runs with component('cloth'), for example entity.component('cloth').windScale = 3 for a storm, or .pin = 'none' to let a banner fall.