I am working on implementing a moving camera in THREE like the example below:
function initializeThree(){
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); //throws error here
}
Upon reaching the line marked, I encounter the following error:
Uncaught TypeError: undefined is not a function
Although, there is an example of it on this page? I am currently using a local version of this THREE build.
Any assistance would be highly appreciated!