I want to create a custom body which have very random shape like a table. So how to add/combine multiple fixtures into a body?


1 Answer 1


You have to use physics editor and using that you have to generate xml file which contains the fixture and body information. Using parsing you have to create PolygonShape, create a new fixture and assign it to the body.

for (int l = 0; l < size; l++)
    vector2s[l] = vectorList.get(l);

PolygonShape polygonShape = new PolygonShape();
FixtureDef fixtureDef = new FixtureDef();
fixtureDef = PhysicsFactory.createFixtureDef(1, 0, 0.8f,
               false, Constants.CATEGORYBIT_BOMB,
                Constants.MASKBIT_BOMB, (short) 0);
fixtureDef.shape = polygonShape;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .