Question

When I try sprite to connect to the body, they get a different coordinates. Sprite follows the body, but they are slightly displaced.

I do the following:

mBody = PhysicsFactory.createCircleBody(mPhysicsWorld,POSITION_X, 
    POSITION_Y, 100, 0, BodyType.StaticBody, FIXTURE_DEF);

    mPlayer = new Sprite(0.0f, 0.0f,100,100 mTextures.getPlayer());

    mScene.getChild(GameObjectsMap.GAMEOBJECTS_LAYER).attachChild(mPlayer );

    mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(mPlayer,
                    mBody, true, true));

    mScene.registerUpdateHandler(mPhysicsWorld);

Why so occurs?

Was it helpful?

Solution

You should use the createCircleBody() method without coordinates. It should be the simplest one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top