Questions about PointerLockControls

i am trying to build a 3d first person shooter,
i am trying to find out where is the code in the script misc_controls_pointerlockthat make you enable to to move the camera with the mouse, i build the part of the game and i can move with the keypad
but i can find out where that part of the script is .

please help

You are looking for THREE.PointerLockControls. The orientation change happens in the onMouseMove() event listener right here:


can you help me with this one… :slight_smile:

TypeError: controls.addEventListener is not a function

It does work in the following example:

I suggest you use this code as a basis for your own project.

last question …

think the issue is with the fact that i include a lot of object with pictures.

to what object in controls.getObject() the addEventListener
‘lock’ and unlock should be attach to

thanks man’ your really helping me out

Sorry, I’m afraid I don’t understand what you are saying. addEventListener() is always called on the control instance, not on a 3D object.

can you help me to understand what
controls.addEventListener do ?

PointerLockControls is derived from EventDispatcher. This is a class from the core that allows the usage of events for custom objects. So it’s possible to register events via addEventListener() and to trigger events via dispatchEvent().

thanks man

so for example what controls.lock() do ?