Venji
Venji

Reputation: 73

How to change the camera's position in LibGdx?

I would like to know why my OrthographicCamera doesn't move. Here is the code I used:

world.getPlayer().setX(world.getPlayer().getX()-0.05f);
camera.position.set(camera.position.x-0.5f, camera.position.y, camera.position.z);
camera.update();

Upvotes: 0

Views: 214

Answers (1)

BittahDreamer
BittahDreamer

Reputation: 113

In your render method have you set your camera projection matrix to combined.

 batch.setProjectionMatrix(camera.combined);//batch is the name of the spritebatch

Upvotes: 2

Related Questions