Polygons shifting position and not lining up with physics

G’day, I’ve been finding the behaviour of polygons really unhelpful because after you’ve created one using display.newPolygon then, as it states in the manual:

These coordinates will automatically be re-centered about the center of the polygon.

This means that if you have a physics body and a polygon using exactly the same shape, then depending on the co-ordinates of the shape the two bodies may or may not match up.

shape1 = {-10,-50, 10,-60, 10,50, -10,50} -- Does not match physics and shape shape2 = {-10,-50, 10,-60, 10,50, -10,60} -- Matches

It also makes it hard if you want to tile different polygons, given that you have to somehow work out where the vertices are after you created the polygon, given that Corona has possibly realigned all the vertices.

Does anyone know the rationale for this behaviour or if there are any easy work-arounds, particularly when trying to use polygons as physics bodies? (It’d be quite useful if there was an optional parameter to display.newPolygon that prevented the automatic realignment of vertices.)

Thanks,

Warwick

The snippet we posted here:
http://code.coronalabs.com/code/create-complex-non-convex-bodies

Also takes care of aligning polygons with physics bodies, might be a good starting point (:

The snippet we posted here:
http://code.coronalabs.com/code/create-complex-non-convex-bodies

Also takes care of aligning polygons with physics bodies, might be a good starting point (: