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);
ball.setLinearVelocity(0f,0f);
ball.setLinearDamping(0f);
ball.setAwake(true);
}
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