World:overlaps

Edit

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:computeOverlaps to compute the list of overlaps. Usually this is called automatically by World:update.

iterator = World:overlaps()

Arguments

None

Returns

NameTypeDescription
iteratorfunction A 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