我的项目基本上可以正常工作,但是总是会抛出此异常:
THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.
render @ three.min.js:196
animate @ fehlersuchen.html:295
(anonymous) @ fehlersuchen.html:139
fehlersuchen.html:227 9 0
您可以看到,我使用three.min.js库,而fehlersuchen.html是我尝试过的html文件。
我的脚本:
var renderer = new THREE.WebGLRenderer();
var camera;
var CANVAS_WIDTH = 900;
var CANVAS_HEIGHT = 500;
camera = new THREE.PerspectiveCamera(25, CANVAS_WIDTH / CANVAS_HEIGHT, 1, 2000);
camera.position.set(5500, 5000, -550);
animate();
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}