I have a code, that add a vertex array to a shape, my code is:
PolygonDef shape = new PolygonDef();
for (int i=0; i<vertices.size(); i++) {
Vec2 v = vertices.get(i);
shape.addVertex(new Vec2(v.x/RATIO,v.y/RATIO));
}
But its very strange because not working good on any of my polygon creator tool.
So with a triangle, it work good:
ArrayList<Vec2> vertices = new ArrayList<Vec2>();
vertices.add(new Vec2(0,-size.height/2));
vertices.add(new Vec2(size.width/2,size.height/2));
vertices.add(new Vec2(-size.width/2,size.height/2));
but with a bigger polygon of 50 to 60 vertices it's not working.
How I can create a usable vertex array from a shape? I have a greyscaled image with black and white colors... How can use this shape (image) to define my vertex array good?
And in box2D with the addVertex how I can add this points to make a normal usable polygon? (counter clockwise?)