@pajter Okay, I’ll aim for the simpler / quicker publishing schedule then.
The meshes are fairly compatible with Corona’s own, e.g. I have roughly this in the tests:
local mlist = msquares.grayscale(pixels, IMGWIDTH, IMGHEIGHT, CELLSIZE, THRESHOLD, "INVERT") local cx, cy = display.contentCenterX, display.contentCenterY for i = 1, #mlist do local mesh = mlist:GetMesh(i) local points, verts = mesh:GetPoints(), {} for i = 1, #points, mesh:GetDim() do local x, y = points[i], points[i + 1] verts[#verts + 1] = cx \* (x - .5) verts[#verts + 1] = cy \* (.5 - y) end display.newMesh(cx, cy, { indices = mesh:GetTriangles(), vertices = verts, mode = "indexed", zeroBasedIndices = true }) end
The idea your image gave me earlier would be to have a little drawing program with a small palette of colors. Then you extract each mesh, putting it into a Corona mesh with the appropriate color, then finally wipe the background. If all goes well you won’t notice, until the objects start moving…
However, the boundary seems more relevant for purposes of collision, thus the “get color -> extract boundary -> make edge chain” comment in my previous post. Adapting the example in the physics docs (untested):
local body = display.newRect( x, y, 40, 40 ) -- just some object to receive the body... body.alpha = .05 -- ...but we probably don't actually want to see it -- if you DO, say as in my idea for a sample, make a mesh in the previous step physics.addBody( body, "static", { chain = boundary[1], connectFirstAndLastChainVertex = true -- with simple shapes, just one element })