Cannot get FirstPersonControls in three.js

I am trying to do this:

controls = new THREE.FirstPersonControls (camera);

controls.movementSpeed ​​= 1000; controls.lookSpeed ​​= 0.125; controls.lookVertical = true;

this did not work, From here I found out that I need to update the control using delta time:

var clock = new THREE.Clock ();

controls.update (clock.getDelta ());

but I get an error undefined is not a functionforTHREE.Clock()

can you tell me a working demo / tutorial using FirstPersonControls or just tell me what happened?

Thank!!

+5
source share
2 answers

controls.update(); ( )?

, misc_sound.html. , init():

controls = new THREE.FirstPersonControls( camera );

                controls.movementSpeed = 70;
                controls.lookSpeed = 0.05;
                controls.noFly = true;
                controls.lookVertical = false;

render():

controls.update();

, -:

controls.update(delta);
+4
+5

All Articles