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'm playing around with jbox2d and can't really make a body "fly away" as if from an explosion.

From what I have found on the net, making the body fly away from the world center (0,0), should have been something like that:

b.applyLinearImpulse( new Vec2(0,0) , b.getPosition() );

But really it just doesn't do anything, any idea why? Also how do I change the strength of the impulse, like if it want to make it fly skyhigh or just move a bit?

share|improve this question
up vote 7 down vote accepted

The first argument of applyLinearImpulse is the vector which is the strength of the force/impulse. So just change it to something else rather than 0,0 and your object should fly.

share|improve this answer
yes! :) changed it to (0,5000) and now they fly upwards. :) thanks! – Roger Travis May 15 '12 at 13:33

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.