Overlaps
What a point or box query found, filled in by PhysicsWorld.queryPoint and PhysicsWorld.queryBox. Make one and keep it: it only allocates when it has to grow, the first few times.
toString gives how many of each it found, for example Overlaps(rigidBodies=2, softBodies=0, solids=1).
Samples
val world = PhysicsWorld()
repeat(5) { world.rigidBody(Shape.circle(4f), x = it * 20f, y = 0f) }
// Make one Overlaps and keep it: it grows when it has to, then allocates nothing.
val found = Overlaps()
val count = world.queryBox(left = 10f, top = -10f, right = 60f, bottom = 10f, found = found)
assertPrints(count, "3")
assertPrints(found, "Overlaps(rigidBodies=3, softBodies=0, solids=0)")Content copied to clipboard