Im trying to get a SpriteBatch drawn to sync up to the position of a body. Im not sure if this is the proper way to do this (in andengine you would just use physics connectors) But i tried drawing the sprite at the position the body was storing.
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
elapsedTime += Gdx.graphics.getDeltaTime();
batch.setProjectionMatrix(camera.combined);
batch.begin();
batch.draw(walkAnimation.getKeyFrame(elapsedTime, true),
mrsaiBody.getPosition().x, mrsaiBody.getPosition().y, width/2, height/2);
batch.end();
mWorld.step(1/30f, 6, 2);
mRenderer.render(mWorld, camera.combined);
The problem im having with this is, on the screen i see mrsaiBody's shape and i see the ground i made. When the shape makes contact with the ground the x and y values still continue to be affected by gravity even though the shape isnt. How can i get the current position of this shape to match up with position when i use batch.draw?