Hi,
I’m trying to use the newOutline API to construct a physics body. however, there seem to be a problem when trying to use the outline to construct the physics body.
In the game I use a picture and I then add a physics with a set of coordinates as outline.
In order to illustrate the issue, i’ve created a small app that takes the list of coordinates and creates a polygon object. if I simply create a physics object from the polygon, the created body is accurate.
However, If I use the set of coordinates as outline to the physics body, the generated body is completely wrong.
Any idea what might be wrong here?
[lua]
local w = display.actualContentWidth
local h = display.actualContentHeight
local physics = require (“physics”)
physics.start()
physics.setDrawMode( “hybrid” )
local createSegment = function()
local imageOutline = {1,0,86,6,132,15,175,28,230,53,313,108,363,128,404,130,438,124,479,106,512,86,512,178,0,178,0,0}
local line = display.newPolygon( 0, 0, imageOutline )
line.y = 100
line.x = 260
physics.addBody(line, “static”, { outline=imageOutline, density=1000, friction=0.0, bounce=0.0, filter=filter})
--physics.addBody(line, “static”, { density=1000, friction=0.0, bounce=0.0, filter=filter})
end
createSegment()
[/lua]