Hi I’ve just updated my app to G2.0 but I’m experiencing a fundamental issue with creating physics bodies from irregular polygons. The physics bodies are misaligned with the visible polygon when created using the same set of vertices. Is this related to auto-centering? Is there a work-around?
The following code snippet demonstrates the problem:
local pshape = { -5,-10, 10,-10, 15,0, 10,10, -5,15 } local p = display.newPolygon( 160, 300, pshape ) p.fill = { 1, 0, 0 } physics.addBody( p, "static", { shape=pshape } )
When viewed in “hybrid” mode, you’ll see the physics body and visible polygon are misaligned.
Just wondering if I’m doing something wrong as it seems pretty fundamental? Any help would be appreciated.