我正试图在三个中实现移动相机:
function initThree(){
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,0.1,1000);
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth,window.innerHeight);
document.body.appendChild(renderer.domElement);
geometry = new THREE.CubeGeometry(1,1,1);
material = new THREE.MeshBasicMaterial({color:0x00ff00});
cube = new THREE.Mesh(geometry,material);
scene.add(cube);
camera.position.z=5;
controls = new THREE.PointerLockControls(camera); //fails at this line
}
在标记的行上,我收到以下错误:
Uncaught TypeError: undefined is not a function
但是,在this页面上有一个例子吗?我目前正在使用this三个版本的本地副本。
任何帮助都会很棒!