I've created a triangle for jbox2d...
public void createTri(){
PolygonDef shape = new PolygonDef();
shape.density = 2.0f;
shape.friction = 0.8f;
shape.restitution = 0.3f;
shape.addVertex( new Vec2(35/RATE,35/RATE) );
shape.addVertex( new Vec2(65/RATE,35/RATE) );
shape.addVertex( new Vec2(45/RATE,55/RATE) );
BodyDef bodyDef = new BodyDef();
bodyDef.position.set(50/RATE, 50/RATE);
bodyT= world.createBody(bodyDef);
bodyT.createShape(shape);
bodyT.setMassFromShapes();
}
... but when drawing it on canvas, how to I get position of all the vertexes?
with bodyT.getPosition().x and .y I can get only the center spot.
Thanks!