I am very confused about camera matrices and I don't know where to start my studying. Maybe I have to study OpenGL, but I don't know C++ ...
Ok so I have a camera, Box2d world and a Box2d body.
private World world;
private Box2DDebugRenderer b2dr;
private OrthographicCamera cam;
private Body player;
@Override
public void create () {
//Create the world without gravity
world = new World(new Vector2(0, 0), false);
b2dr = new Box2DDebugRenderer();
//I create my camera
cam = new OrthographicCamera();
//Create the player
BodyDef bdef = new BodyDef();
bdef.type = BodyDef.BodyType.DynamicBody;
//Sets the body position to the center of the screen
bdef.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
player = world.createBody(bdef);
CircleShape shape = new CircleShape();
shape.setRadius(2f);
player.createFixture(shape, 1f);
}
@Override
public void render () {
world.step(1f/60f, 6, 2);
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
b2dr.render(world, cam.combined);
}
I am not seeing the player on the center of the screen, just a black void.
But if I add cam.setToOrtho(false); I see the player! Why is that?
setToOrtho sets the camera to Orthographic projection WHY?
The camera is Orthographic what oder projection can it have?? Isn't the orthographic projection obvious?
setToOrtho
is not about setting it ortho or not ortho, it's about where does the y axis points: up or down. \$\endgroup\$