Dav*_*óth 2 java 3d graphics libgdx
我已经用相机设置了一个场景
cam = new PerspectiveCamera(80, w, h);
cam.position.set(0, 0, -1);
cam.lookAt(0, 0, 0);
cam.update();
Run Code Online (Sandbox Code Playgroud)
但是有些场景丢失了,因为它超出了相机的视距.
答案很简单,但并不明显:
设置perspectiveCamera渲染距离,只需添加
cam.near = 0.1f;
cam.far = 500;
Run Code Online (Sandbox Code Playgroud)
之前update().
完整源代码:
cam = new PerspectiveCamera(80, w, h);
cam.position.set(0, 0, -1);
cam.lookAt(0, 0, 0);
cam.near = 0.1f;
cam.far = 500;
cam.update();
Run Code Online (Sandbox Code Playgroud)