World:overlaps

Returns an iterator that can be used to iterate over "overlaps", or potential collisions between pairs of shapes in the World. This should be called after using World:detectOverlaps to compute the list of overlaps. Usually this is called automatically by World:update.

iterator = World:overlaps()

Arguments

None

Returns

NameTypeDescription
iteratorfunctionA Lua iterator, usable in a for loop.

Example

world:computeOverlaps()
for shapeA, shapeB in world:overlaps() do
  local areColliding = world:collide(shapeA, shapeB)
  print(shapeA, shapeB, areColliding)
end

See also