setSolidCollision
Sets whether particle is kept out of the solids, the SolidGrid and its moving solids. It is SolidCollision.COLLIDE by default; a SolidCollision.PASS particle falls through the level. For a soft body's particles, set the whole body's with SoftBodies.setSolidCollision.
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 drop = world.particles.add(x = 160f, y = 100f, radius = 2f)
world.particles.setSolidCollision(drop, SolidCollision.PASS)
assertPrints(world.particles.solidCollisionOf(drop), "PASS")
repeat(60) { world.step(1.seconds / 60) }
// It fell through the floor.
assertTrue(world.particles.yOf(drop) > 160f)Content copied to clipboard