I want to maintain the speed of a free-falling Box2D body using LibGDX. I'd like the vertical velocity increase with the level. I've applied a linear impulse and velocity actually increases like this:
fruitBody.applyLinearImpulse(0, -800, fruitBody.getLocalCenter().x, fruitBody.getLocalCenter().y, true); I think this is a bad approach, because the speed has increased only a little and I applied as much as -800 units of impulse.
Below is my render function of game play screen class:
public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // camera.update(); // batch.setProjectionMatrix(camera.combined); batch.begin(); backgroundSprite.draw(batch); grassSprite.draw(batch); // bucketSprite.draw(batch); Iterator<Body> bodies = world.getBodies(); while(bodies.hasNext()){ Body body = bodies.next(); if(body.getUserData() != null){ String spriteName = (String) body.getUserData(); Sprite sprite = (Sprite) userDataMap.get(spriteName); if(spriteName.equals("bucket")) sprite.setPosition(body.getPosition().x + 345, body.getPosition().y + 230); else sprite.setPosition(body.getPosition().x + 375, body.getPosition().y + 225); sprite.draw(batch); } } batch.end(); fruitBody.applyLinearImpulse(0, -800, fruitBody.getLocalCenter().x, fruitBody.getLocalCenter().y, true); // debugRenderer.render(world, camera.combined); world.step(1/60f, 8, 3); // world.clearForces(); } My world is:
world = new World(new Vector2(0, -10), true); Orthographic camera:
camera = new OrthographicCamera(800, 480); My fruitBody fixture def is:
bodyDef.type = BodyType.DynamicBody; bodyDef.position.set(0, 100); // shape CircleShape ballShape = new CircleShape(); ballShape.setRadius(15f); //fixture fixtureDef.friction = .1f; fixtureDef.restitution = .7f; fixtureDef.shape = ballShape; fixtureDef.density = .2f; fruitBody = world.createBody(bodyDef); // fruitBody.setUserData(fruitSprite); fruitBody.setUserData("fruit"); fruitBody.createFixture(fixtureDef); I just want to increase the fruit's speed (free falling body) at each level by a given value.

BodyDef.BodyTypetoKinematicBodyand callsetLinearVelocitywith some velocity vector for each body you create. The fruit will move at a constant speed across the screen. If you want the bodies to fall (accelerate) under the influence of gravity and reach terminal velocity, that is a different story. I can provide a complete answer if this is what you are looking for. \$\endgroup\$