Closed kurazl closed 1 year ago
If you can reproduce this consistently I would add logs for things like the mouse movement value or rotation values in this onMouseMove function to see what the source of the "jump" is - that might help determine whether the issue is a browser or device problem or not.
@gkjohnson Could you give what exactly within that function I should be logging? I am logging this movementX
and movementY
but I'm not seeing anything abnormal when it comes to these jumps.
Could you give what exactly within that function I should be logging?
You should log the intermediate and final variables that are used to drive the rotation of the camera. If the "jump" is caused by PointerControls you'll see larger "jumps" in values before and after you set the euler rotation, for example.
When my mouse's polling rate is set to 500, this happens but at a much lower rate. When my mouse's polling rate is set to 125, I rarely experience this.
Can you also clarify what this means. How are you changing your mouse settings.
Can you also verify if this happens with latest Firefox?
(wired mouse was not tested, although I do not suspect it would make a difference)
It would be interesting to see if other mice produce the same issue with the same Windows 11 computer.
Closing. Device issues like that can't be fixed on engine level.
I faced similar issue as well. The PointerLockControl mouse movement sometimes skip/jump/teleport around randomly, happen in Edge, Chrome, and FireFox. In FireFox, it feel more like something is pushing your mouse movement and move to wrong direction with smooth movement instead of teleporting and jumping around.
The issue seems kind of random, sometimes mouse movement will skip and jump around a lot, sometimes less often. But it happens enough to be noticeable.
The only workaround I found is to set the control pointerSpeed
to 10 or higher value, which somehow result in much lesser chance (if not zero) on mouse teleporting and jumping around. But we are limited to use the super sensitive and fast mouse movement.
Description
This issue is seen even on the FPS examples provided by three.js here and here. Every single application of PointerLockControls from established games like https://krunker.io/ to small time FPS examples on Github, I experience this issue as well.
After testing various mouse issue, it seems to have something to do with the polling rate. When my mouse's polling rate is set to 1000, there are instances where the camera "skips" or "teleports" which is unexpected. When my mouse's polling rate is set to 500, this happens but at a much lower rate. When my mouse's polling rate is set to 125, I rarely experience this.
Another factor in testing this was whether I was streaming or not. When I was streaming (I was streaming on Discord), this happened quite frequently. When I stopped streaming, this happened, but less frequently. (Note, previous polling rate experiments were done while streaming.)
Hardware Recreation:
Reproduction steps
Code
N/A
Live example
Screenshots
This is not my video, but a video of this in krunker.io: https://youtu.be/oQRS7pAaxIc?t=16
Right at the end of the 16th second, his POV gets "teleported" to a different angle instantaneously. This also happens at the end of the 18th second as well.
Video revolving around fixing this issue seen in krunker (which I've also seen in FPS examples provided by three.js themselves) suggest to lower polling rate:
Reddit post with top comment suggesting to lower polling rate:
This was how I found this connection between polling rate and PointerLockControl jumping.
Version
N/A
Device
Desktop
Browser
Chrome, Edge
OS
Windows