I want to use physics.queryRegion to detect physic body . It works well when the physic body is rect, but if it is a circle or irregular shape, the body will be hit even the hit point is outside the physic body.
-- the circle should be green because the query point is outside the physic body, but it's red now. local physics = require("physics") physics.start() local circle = display.newCircle(500, 500, 250) circle:setFillColor(0, 1, 0, 1) -- green physics.addBody(circle, "static", {radius = 250}) local rect = display.newRect(0, 0, 10, 10) rect:setFillColor(1, 1, 1, 1) rect:translate(circle.x - 250 +5 , circle.y - 250 + 5) local hits = physics.queryRegion(circle.x - 250, circle.y - 250, circle.x - 250 + 10, circle.y - 250 + 10) if (hits) then for i, v in ipairs(hits) do if v == circle then circle:setFillColor(1, 0, 0, 1) --red end end end