how to create various shape object? polygonal is not enough

@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 })

Hi.

The day of reckoning came for me last week on a plumbing problem and I didn’t get a whole lot done. Difficult to accomplish much when hammers are pounding not far away; struggling with some updated VPN settings too, so wasn’t able to do remote builds on my office Mac either.

That said, in the last couple days I did make a little headway. I’ve attached a GIF of the idea I had earlier, now a passable sample.

You can paint various color-coded “objects” and then bake them into meshes that then fly around. I also bake a mask and apply it to the canvas, though maybe I should add some underlying effect to better demonstrate this. The interface is a bit clumsy at the moment. Maybe I’ll switch the buttons around to a palette and some text or something.

Code so far here. Never mind the rest of the scenes; I copied over the structure from the last plugin I submitted.  :slight_smile:

Update: the msquares plugin is now out. I’ve revised the sample shown above and also added another one with physics. Probably further examples to follow down the road.