I’m creating a FPS game for a game jam and I noticed a bug that appears to be present only in Chromium-based browsers.
Using Chrome, Edge, or any other Chromium-based browser, at random while you’re turning the camera, the camera will jump back in the opposite direction a huge amount. I first noticed this happening in my game after following the tutorial, and after testing the tutorial in the browser for a bit I noticed it happens there too.
I’ve outputted the “mousemove” event to the console, and I’ve found that while turning in a direction I will get integers from 1 to 10 outputted for event.dx (or event.dy, it happens for both) like normal or however fast the player is turning in a smooth line, and then suddenly it will jump in the opposite direction to an extreme number from -50 to -450 or 50 to 450 on average.
It’s extremely unpredictable when it happens, so you do have to be patient for it to replicate, but when it happens it can happen as much as 3 times in a row. I’m sure it’s not gimble lock because I’ve outputted those values to the screen and I’ve confirmed it’s the mousemove event itself that’s outputting the crazy numbers.
The problem does not seem to be present on Firefox, as I was unable to replicate it between my game, the tutorial, and another user who happens to be participating in the same game jam as me using PlayCanvas. I brought it up with the other user and they said they had thought their mouse was bugging out, which was my initial reaction too before seeing that Firefox does not output a gigantic leap in values at random.
I’ve tried to code around it by ignoring frames that have a ridiculously high absolute value event.dx or event.dy, but unfortunately the jump can be pretty low too like a normal player mouse movement and it’s not a great fix.
Any ideas why this might be happening?