Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 have been playing with box2d in libgdx and have made a falling ball.

Once the ball lands on the ground I want to be able to reset it to the top with the space-bar key

I have done this:

if (Gdx.input.isKeyPressed(Keys.SPACE))

        ball.setTransform(200f, 447f, 0f);

this seems to work fine except for one thing: the ball falls with a much higher velocity then it does the first time (when the application opens).

I have set the LinearVelocity to 0 so I don't get why it behaves differently to the ball on the start of the app?

Am I missing something?

Thanks for the help, Jason

share|improve this question

closed as off-topic by Anko, Seth Battin, Josh Petrie Feb 26 '14 at 4:05

  • This question does not appear to be about game development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Ran the C++ analog of your code snippet, but the ball appears to fall at the same speed regardless. I see nothing wrong with your code either. Does it have 0 damping to start with? It may be getting set to something else in the default constructor. – Anne Quinn Sep 17 '11 at 2:39
@Clairvoire: Hmm interesting.. I suppose it's a bug in libgdx then. I will open a bug report on libgdx. Thanks for your time. – Jason Sep 17 '11 at 8:29
This question appears to be off-topic because it is about a Libgdx bug best discussed with the Libgdx developers. – Anko Feb 25 '14 at 0:21

Browse other questions tagged or ask your own question.