isPointInsidePolygon({ x = object[i].x, y = object[i].y}, polygon)
function isPolygonInsidePolygon(poly1, poly2)
poly1 = game.CurrentScene.SceneObjects[poly1].ObjectPolygon
poly2 = game.CurrentScene.SceneObjects[poly2].ObjectPolygon
for i = 1, #poly1 do
if isPointInsidePolygon({x = poly1[i].x, y = poly1[i].y}, poly2) then
return true
end
end
return false
end
function sortPolygon(obj)
local polygonTable = {}
for i = 1, #obj.ObjectPolygon do
table.insert(polygonTable, { x = obj.ObjectPolygon[i].x + obj.ObjectOffset.x, y = obj.ObjectPolygon[i].y + obj.ObjectOffset.y})
end
return polygonTable
end
function isPolygonInsidePolygon(poly1, poly2)
poly1 = sortPolygon(poly1)
poly2 = sortPolygon(poly2)
for i = 1, #poly1 do
if isPointInsidePolygon({x = poly1[i].x, y = poly1[i].y}, poly2) then
return true
end
end
return false
end
polygons = {"OBJ_heart_01", "OBJ_heart_02", "OBJ_heart_03", "OBJ_heart_04", "OBJ_heart_05"}
function isPolygonInsidePolygons(polygons, object)
for i = 1, #polygons do
if isPolygonInsidePolygon(Objects[polygons[i]], object) then
break
end
end
end
local polygonTable = {}