Complex bodies

Can anyone tell me why this is not creating the correct complex physics body? It is not meant to be square…

[lua]display.setStatusBar(display.HiddenStatusBar)
local physics = require(“physics”)
physics.start()
physics.setGravity(0,0)
physics.setDrawMode(“hybrid”)

function createBody( design )
local body = display.newGroup()
for t=1, #design do
local s = design[t].shape
for i=1, #s-2, 2 do
local line = display.newLine( body, s[i], s[i+1], s[i+2], s[i+3] )
line.width = 3
end
local line = display.newLine( body, s[1], s[2], s[#s-1], s[#s] )
end
physics.addBody( body, “dynamic”, design )
return body
end

local large = {
{ friction=0, bounce=0, density=1, shape={ 19,-61 , 71,-39 , 83,-51 , 119,-25 , 109,45 , 65,51 } } ,
{ friction=0, bounce=0, density=1, shape={ 65,51 , 27,79 , 23,35 , -31,3 , -3,-23 , 19,-61 } } ,
}

local a = createBody( large )
a.x, a.y = 200,200[/lua]
[import]uid: 8271 topic_id: 22435 reply_id: 322435[/import]

Without drawing it out, its hard to say, but do they:

wind around the object in a clockwise manner?

are they convex shapes, not concave?

It looks like your first shape is concave. You go from y-61,to y-39, to y-51, that 71,-39 point is inset. [import]uid: 19626 topic_id: 22435 reply_id: 89455[/import]

Rendering the shapes individually shows that they do seem to be clockwise and convex. I broke the overall shape out into smaller tables to keep them convex and less than 8 points. I followed the method which physics editor seems to have used, but I’ve obviously gone wrong somewhere. [import]uid: 8271 topic_id: 22435 reply_id: 89484[/import]

And of course you were right… When I break the composite elements down it works! [import]uid: 8271 topic_id: 22435 reply_id: 89580[/import]