Pointer lock mouse lag

I’m working on an FPS and have run into a weird mouselook issue.

I listen to pc.EVENT_MOUSEDOWN and use this.app.mouse.enablePointerLock() to lock and hide the mouse. Then I listen to pc.EVENT_MOUSEMOVE for moving the player’s view using e.dx and e.dy. I believe that’s just how you do it, right? And it seems to work great. :smile:

For the most part… I’m not sure I can explain it well, nor that my observation is entirely correct. It seems like the first time I launch the game and click on the screen to engage pointer-lock, everything is nice and smooth. As smooth and responsive as the browser delivers pc.EVENT_MOUSEMOVE at 60 frames per second, anyway. But if I stop pointer lock by pressing ESC and click on it to engage pointer lock once more, it seems the mouse is lagging a bit behind. Like there’s a delay before the events that move the camera are fired…

Is this perhaps a known browser thing? IIRC I may have read something like that somewhere…? :thinking:

Hi @ra_rasmus,

I don’t have experience with that, but it does remind me of this post:

Yeah sounds like a different issue. Still interesting, tho. I guess it might be prudent to calculate the delta positions manually - if they are actually valid in that case

1 Like