Then we set the camera 10 units to the right, 10 units up and 10 units back.
public class Basic3DTest implements ApplicationListener {
public PerspectiveCamera cam;
@Override
public void create () {
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(10f, 10f, 10f);// x向右为正 y 向上为正 z 想上为正
cam.lookAt(0,0,0);
cam.near = 1f;
cam.far = 300f;
cam.update();
}
...
}
Here we create a new PerectiveCamera with a field of view of 67 degrees (which is common to use) and we set the aspect ratio to the current width and height. Then we set the camera 10 units to the right, 10 units up and 10 units back. The Z axis is pointing towards the viewer, so for the viewer a positive Z value of the camera is moving the viewer back . We set the camera to look at (0,0,0) because that is where we are placing our 3D object to view. We set the near and far values to make sure we would always see our object. And finally we update the camera so all changes we made are reflected by the camera.