i'm trying this:
controls = new THREE.FirstPersonControls(camera);
controls.movementSpeed = 1000; controls.lookSpeed = 0.125; controls.lookVertical = true;
it didn't work, From here i found out that i need to update the control with time delta:
var clock = new THREE.Clock();
controls.update( clock.getDelta() );
but I get undefined is not a function
error for THREE.Clock()
can you please point me to working demo/tutorial with FirstPersonControls, or just tell me whats wrong?
Thanks!!
i'm trying this:
controls = new THREE.FirstPersonControls(camera);
controls.movementSpeed = 1000; controls.lookSpeed = 0.125; controls.lookVertical = true;
it didn't work, From here i found out that i need to update the control with time delta:
var clock = new THREE.Clock();
controls.update( clock.getDelta() );
but I get undefined is not a function
error for THREE.Clock()
can you please point me to working demo/tutorial with FirstPersonControls, or just tell me whats wrong?
Thanks!!
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Nov 9, 2011 at 10:59 Sergej PopovSergej Popov 3,0216 gold badges37 silver badges54 bronze badges 02 Answers
Reset to default 8Have you tried simply calling controls.update();
(withough passing a delta) ?
I've just tried using the class by copying a bit of code from the misc_sound.html example. So in init():
controls = new THREE.FirstPersonControls( camera );
controls.movementSpeed = 70;
controls.lookSpeed = 0.05;
controls.noFly = true;
controls.lookVertical = false;
and in render():
controls.update();
Update
As Todd points out, in newer versions, a delta time argument needs to be supplied:
controls.update(delta);
Please note that in R49, this api now requires the 'delta' on the update call. The delta needs to be the millisecond displacement since last update, which should be passed out through the requestAnimationFrame callback.
http://paulirish./2011/requestanimationframe-for-smart-animating/