How to initiate Three.js PointerLockControls when camera is not at origin?

I am trying to use PointerLockControls in my three.js game and I want my player to start from another point but not from origin.

Let's say I want to start playing from 1000,0,0. If I place: camera.position.set(1000, 0, 0) in line 193 in http://threejs.org/examples/#misc_controls_pointerlock

then the example shows a weird behavior: When I move the mouse the camera is orbiting around origin with a radius of 1000. I would expect to start first person view from 1000,0,0. How to achieve that?


I found it my self. Controls should be moved, not the camera.

Just add

controls.getObject().position.set(1000, 0, 0);

in line 204 and it works fine.

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

上一篇: three.js,吐温相机和mousemove事件

下一篇: 摄像机不在原点时如何启动Three.js PointerLockControls?