I'm trying to rotate my OrthographicCamera
in the render loop to a fixed angle, but I can only make the camera spin. This is the code that I have:
in create()
:
OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(true, 100, 100);
camera.position.set(50, 50, 0);
camera.update();
in the render loop:
camera.rotate(30);
camera.update();
The camera keeps spinning each frame. But I'd like the camera to stay at 30 degrees.
I have already seen this answer:
https://stackoverflow.com/questions/16509244/set-camera-rotation-in-libgdx
But I don't like it because this code is too drastic. I wonder if there is a more "common" way to do this.