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

I can't make body (box2d) a sprite (andengine) and at the same time apply MoveModifier to sprite which is body. If i can make just body, it works namely the sprites can collide. If I apply just MoveModifier to sprites, the sprites can move where i want. But I want to make body (they can collide) and apply MoveModifier (they can move where I want) at the same time. How can i do it? This my code just run MoveModifier not as body at the same time.

    circles[i] = new Sprite(startX, startY, textRegCircle[i]);
    body[i] = PhysicsFactory.createCircleBody(physicsWorld, circles[i], BodyType.DynamicBody, FIXTURE_DEF);
    physicsWorld.registerPhysicsConnector(new PhysicsConnector(circles[i], body[i], true, true));
            (IEntityModifier) new SequenceEntityModifier (
                        new MoveModifier(10.0f, circles[i].getX(),  circles[i].getX(), 
share|improve this question

It is exactly as Khawar Raza says. When you connect a body with your physics engine and apply Modifier, the modifier will be active but at the same time the physics will override the change in update loop.

It depends on what kind of movement do you need to do, but your options are:

  • Body.setLinearVelocity
  • Body.applyLinearImpulse or Body.applyForce - this is a better way to set the Velocity
  • using MouseJoint.setTarget. This will make the body go to a "target" point.

I recommend checking all of them, but I bet MouseJoint is the one you want. Check out this tutorial:

share|improve this answer

I think you cannot apply move modifiers on physics bodies. If you want to move bodies, you have to use other methods like force, impulse or setting velocity.

share|improve this answer
Moving the body directly should be possible with a kinetic body. Although kinetic bodies have other downfalls. – bummzack Jan 21 '13 at 12:56

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.