setSelfCollision
Sets whether body's skin is kept from passing through itself, as when it folds over. It is SelfCollision.PASS by default: a body that does not fold does not need it, and it costs a check of every ring particle against every edge.
Samples
val world = PhysicsWorld()
// A floor of 16-unit tiles along row 9, its top at y = 144.
val grid = SolidGrid(columns = 20, rows = 10, tileSize = 16f)
for (column in 0 until 20) grid.fill(column, 9)
world.solids = grid
val sheet = world.softBody(SoftBodyShape.box(80f, 8f, across = 10, down = 1, coreMass = 1f), centerX = 160f, baseY = 100f)
// A long thin body folds over when it lands; keep its skin from passing through itself.
world.softBodies.setSelfCollision(sheet, SelfCollision.COLLIDE)
assertPrints(world.softBodies.selfCollisionOf(sheet), "COLLIDE")Content copied to clipboard