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!!
Have 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.com/2011/requestanimationframe-for-smart-animating/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With