Three.js First Person Controls moves the camera all the time

The game I'm designing currently requires a first person controller and luckily Three.js offers that class as well.

However I can't stop the camera from flying around. I know that the mouse movement causes the fly because it happens as soon as I move the mouse. But reading the js code,I cant find the attribue which causes this movement. Here is how I initiate the controls:

controls = new THREE.FirstPersonControls(camera);
controls.movementSpeed = 0.1;
controls.lookSpeed = 0.001;
controls.lookVertical = true;

I do not want the view direction to change when I am not moving the mouse.

any idea ?


Keep in mind that the FPS style mouse movement in webGL is usable rather only in a full screen mode. If an application runs in a standard windowed mode, the cursor is visible, and the application can not detect cursor movements that cross the edge of the window. This makes it impossible to look around in the FPS style (look movement stops when the cursors reaches the window edge).

This is probably the main reason why a PointerLockControls demo asks you to switch to the full screen mode.

With FirstPersonControls the look movement continues when the mouse reaches the edge. Such approach works well in the windowed mode.


You might want to use the PointerLockControls instead

See an example here: https://github.com/mrdoob/three.js/blob/master/examples/misc_controls_pointerlock.html

链接地址: http://www.djcxy.com/p/14592.html

上一篇: 排序鉴别器

下一篇: Three.js First Person Controls始终移动摄像头