1, How to add a simple Polygon to a body?
my code is:
Is it good?
2,
How can I create polygon vertexes ArrayList<Vec2> from an image (transparent png image with one single image center of it) ?
my code is:
Code:
if (type==BODY_TYPE.STATIC) body=world.createStaticBody(bodyDef);
else if (type==BODY_TYPE.DYNAMIC) body=world.createDynamicBody(bodyDef);
PolygonDef shape = new PolygonDef();
shape.vertices=vertices;
shape.density = 1.0f;
shape.restitution = resti;
body.createShape(shape);
body.setMassFromShapes();
else if (type==BODY_TYPE.DYNAMIC) body=world.createDynamicBody(bodyDef);
PolygonDef shape = new PolygonDef();
shape.vertices=vertices;
shape.density = 1.0f;
shape.restitution = resti;
body.createShape(shape);
body.setMassFromShapes();
Is it good?
2,
How can I create polygon vertexes ArrayList<Vec2> from an image (transparent png image with one single image center of it) ?