Cloth
A sheet made by PhysicsWorld.cloth: a grid of columns by rows particles, held by structural links along its rows and columns, shear links across each square, and bends along its rows and columns.
toString gives its size, for example Cloth(12x8).
Samples
val world = PhysicsWorld()
// A curtain 12 particles across and 8 down, hanging from its top row.
val curtain = world.cloth(left = 0f, top = 0f, columns = 12, rows = 8, spacing = 6f)
assertPrints(curtain, "Cloth(12x8)")
assertPrints(world.particles.inverseMassOf(curtain.particleAt(5, 0)), "0.0")
assertPrints(world.particles.inverseMassOf(curtain.particleAt(5, 7)) > 0f, "true")Content copied to clipboard