Well, I can't make you understand a simple comment. Try by code:
Screen
public class TestScreen implements Screen {
SpriteBatch batch;
OrthographicCamera camera;
World world;
Box2DDebugRenderer dr;
Ball ball;
public TestScreen() {
batch = new SpriteBatch();
camera = new OrthographicCamera(1.6f, 1f);
world = new World(new Vector2(0, -9.8f), true);
ball = new Ball(.11f, world);
dr = new Box2DDebugRenderer(true, false, false, false, false, false);
}
@Override
public void show() {
}
@Override
public void render (float delta) {
Gdx.gl.glClearColor(.1f, .1f, .14f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.setProjectionMatrix(camera.combined);
world.step(Gdx.graphics.getDeltaTime(), 6, 2);
batch.begin();
ball.draw(batch);
batch.end();
dr.render(world, camera.combined);
}
}
Ball.java
public class Ball {
private float radius;
private CircleShape shape;
private FixtureDef fixtureDef;
private BodyDef bodyDef;
private Body circleBody;
private Texture ballTexture;
public Ball(float radius, World world) {
this.radius = radius;
ballTexture = new Texture("sprites/soccerball.png");
bodyDef = new BodyDef();
bodyDef.type = BodyDef.BodyType.DynamicBody;
bodyDef.position.set(0, 0);
shape = new CircleShape();
shape.setRadius(radius);
fixtureDef = new FixtureDef();
fixtureDef.shape = shape;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.4f;
fixtureDef.restitution = 0.6f;
circleBody = world.createBody(bodyDef);
circleBody.createFixture(fixtureDef);
}
public void draw(SpriteBatch batch)
{
batch.draw(ballTexture, circleBody.getPosition().x - radius, circleBody.getPosition().y - radius,
radius * 2, radius * 2);
}
}
Run what you did wrong:
9,8 . , , - . , ( ), , .
25 , 1920 . , 2 , . , , 9,8 .
, , . 11 , 0,11 . , , . ( , ).
, , , . , vp , . , - . , .
, , , , .