Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey I have created my body using following code: (please read full description)

    Body polyBody;
    final BodyDef mBodyDef = new BodyDef();
    mBodyDef.type = BodyDef.BodyType.DynamicBody;
    mBodyDef.position.x = 20;
    mBodyDef.position.y = 5;
    polyBody= mPhysicsWorld.createBody(mBodyDef);       
    final PolygonShape mPoly = new PolygonShape();
    objectFixtureDef.shape = mPoly;

Now it's time for connecting my polygon with body using PhysicsConnector and when I do mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(mPoly, polyBody, true, true)); it doesn't accept mPoly as I expect an IAreaShape instead.

Is there any way that i can parse my it to IAreaShape? or can anyone suggest how can I create a body without using sprite. Its strictly prohibited that I can't use sprite as I need to cut/slice my body further.

share|improve this question

I think you are working with AndEngine. You misunderstood the concept of PhysicsConnector. PhysicsConnector need sprite and body to create. But here mPoly is a PolygonShape object that has functionality of box2d not of sprite.

If you don't want to use sprite then there is no need of PhysicsConnector. Basically PhysicsConnector used to attach sprite with body. So developer does not need to render it manually.

Also you have to use pixel to meter ratio to apply position and size of the object. In AndeEngine you can use constant with PhysicsConstant.PIXEL_TO_METER_RATIO.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.