camera rotates pointerlockcontrols

2019-07-12 18:32发布

问题:

I have used mrdoob's PointerLockControls.js example for this project. Everything works fine until I change the

    camera.position.set(2, 2, 3 );

to this

    camera.position.set(1100, 150, -50 );

It seems to 'rotate' along the z axis instead of just looking.

回答1:

You need to do this:

controls.getObject().position.set( 1100, 150, -50 );

This is because of the clever way PointerLockControls handles camera movement.