This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Manipulating Camera
Pawel Pastuszak edited this page Dec 7, 2018
·
1 revision
CameraManager
allows you to access camera and change it's position, rotation etc.
Moving camera using arrows keys
@Wire
public class TestCamera extends BaseSystem {
//this will be automatically assigned by artemis-odb, see @Wire annotation above
private CameraManager cameraManager;
@Override
protected void processSystem () {
Vector3 position = cameraManager.getCamera().position;
float delta = 0.2f;
//move camera using WSAD keys
if(Gdx.input.isKeyPressed(Keys.W))
position.y += delta;
else if (Gdx.input.isKeyPressed(Keys.S))
position.y -= delta;
if(Gdx.input.isKeyPressed(Keys.D))
position.x += delta;
else if (Gdx.input.isKeyPressed(Keys.A))
position.x -= delta;
}
}