FirstPersonControls is not a constructor

getting-started
#1
FirstPersonControls is not a constructor

please I do not understand, here is my code:

camera = new THREE.PerspectiveCamera (75, window.innerWidth / window.innerHeight);
controls = new THREE.FirstPersonControls (camera);

but the console sends me back:

Uncaught TypeError: THREE.FirstPersonControls is not a constructor.

Where is the problem ? help me

0 Likes

#2

That happens because THREE.FirstPersonControls is no part of the library core. You have to include it manually like in this example:

https://threejs.org/examples/webgl_geometry_minecraft.html

The file is located here: examples/js/controls/FirstPersonControls.js

2 Likes