forEach
Calls action with every body alive, in slot order. action may remove the body it is given, but must not add any.
Samples
val world = PhysicsWorld()
repeat(3) { world.rigidBody(Shape.circle(5f), x = it * 20f, y = 0f) }
var count = 0
world.rigidBodies.forEach { body -> if (world.rigidBodies.kindOf(body) == BodyKind.DYNAMIC) count++ }
assertPrints(count, "3")Content copied to clipboard