///// body construction BodyDef bodyDef = new BodyDef(); // We set our body to dynamic, for something like ground which doesnt move we would set it to StaticBody bodyDef.type = BodyType.DynamicBody; // Set our body's starting position in the world bodyDef.position.set(100, 200); // Create our body in the world using our body definition Body body = world.createBody(bodyDef); // Create a circle shape and set its radius to 6 CircleShape circle = new CircleShape(); circle.setRadius(20f); // Create a fixture definition to apply our shape to FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = circle; fixtureDef.density = 500f; fixtureDef.friction = 0f; fixtureDef.restitution = 1f; // Create our fixture and attach it to the body fixture = body.createFixture(fixtureDef); //// apply force on press of keys Vector2 impulse = new Vector2(); impulse.x = ( Gdx.input.isKeyPressed( Input.Keys.LEFT ) ? - 1000 : ( Gdx.input.isKeyPressed( Input.Keys.RIGHT ) ? 1000 : 0 ) ); impulse.y = ( Gdx.input.isKeyPressed( Input.Keys.UP ) ? 1000 : ( Gdx.input.isKeyPressed( Input.Keys.DOWN ) ? - 1000 : 0 ) ); fixture.getBody().applyLinearImpulse(impulse, fixture.getBody().getWorldCenter()); //// painting using the body pos Actor e = (Actor) b.getUserData(); if (e != null) { // Update the entities/sprites position and angle e.setPosition(b.getPosition().x, b.getPosition().y); // We need to convert our angle from radians to degrees e.setRotation(MathUtils.radiansToDegrees * b.getAngle()); }