WebQuake
WebQuake copied to clipboard
Mouse jump glitchy problem with Chrome Win10 360 spin keep moving mouse to right.
A problem that can happen when spinning around is that the position suddenly jumps a lot in Chrome. There may be a fix for this that they have not pushed into Chrome yet.
I am only listing this issue here because I noticed it in WebQuake in-case others have this problem and think WebQuake is to blame, it is not related to WebQuake.
Possible work around, lerp the delta by some constant not ideal.
function lerp(v0, v1, t) {
return (1 - t) * v0 + t * v1;
}
function getChromeVersion () {
var pieces = navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/);
if (pieces == null || pieces.length != 5) {
return undefined;
}
pieces = pieces.map(piece => parseInt(piece, 10));
return {
major: pieces[1],
minor: pieces[2],
build: pieces[3],
patch: pieces[4]
};
}
var usePointerLock360BugWorkaround = false;
var chromeVersion = getChromeVersion();
if (chromeVersion) {
usePointerLock360BugWorkaround = true;
IN.mouse_delta_x = 0;
IN.mouse_delta_y = 0;
}
IN.onmousemove = function(e)
{
if (document[IN.pointerLockElement] !== VID.mainwindow)
return;
if (usePointerLock360BugWorkaround === false) {
IN.mouse_x += e[IN.movementX];
IN.mouse_y += e[IN.movementY];
} else {
// Workaround Chrome mouseMove "sudden jump" bug.
IN.mouse_delta_x = lerp(IN.mouse_delta_x, e[IN.movementX], 0.75);
IN.mouse_delta_y = lerp(IN.mouse_delta_y, e[IN.movementY], 0.75);
IN.mouse_x += IN.mouse_delta_x;
IN.mouse_y += IN.mouse_delta_y;
}
};
Related links: http://www.html5gamedevs.com/topic/34516-pointer-lock-bug-on-chrome-with-windows-10/ https://bugs.chromium.org/p/chromium/issues/detail?id=781182 https://bugs.chromium.org/p/chromium/issues/detail?id=461373 https://bugs.chromium.org/p/chromium/issues/detail?id=411634 https://bugs.chromium.org/p/chromium/issues/detail?id=784122
Possible work around to lerp the delta values found here, going to try adding this as a work-around. https://github.com/mrdoob/three.js/issues/12757
What kind of mouse are you using? If it's wireless, is it RF or Bluetooth?
Hi @efess , Wired steelseries. Also I have a 4k screen if that matters any. Still happening on Version 73.0.3683.103 (Official Build) (64-bit) with the same WebQuake code from back when I posted this just wanted to check if browser updates had fixed it but sadly has not.
Apparently this is a bug with how windows is "adjusting" the x/y values when provided to chromium. This behavior can be bypassed by using the chrome specific option unadjustedMovement
when requesting pointer lock.
Details here:
https://chromestatus.com/feature/5723553087356928