Mouse look: hold the stick for as long as the flick was owed (fixes sharp moves doing nothing) #1195
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1195"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Alxspb on 2026-11-28T15:18:42Z.
Stacked on #989 (the mouse-camera feature) and #1149 (the F1 sensitivity row); contains both, review the last commit.
Symptom (from players of the keyboard-and-mouse stand-in, #989)
A sharp mouse move turned the camera not at all, while a slow drag worked - but exactly like a gamepad stick. The faster the move, the less it registered.
Why
The pad is a state device, not a delta one:
XINPUT_GAMEPAD"describes the current state of the controller" (GDKX,reference/input/xinputongameinput/structs/xinput_gamepad.md), and GameInput axes carry a dead zone around the center position (GDKX,reference/input/gameinput/deprecated/structs/gameinputcontrolleraxisinfo.md,deadZone). The mapper pushed the stick with each poll's motion and let it fall back with a 45 ms half-life. The title samples the pad at its own frame times - and it draws a few frames a second at busy moments. A flick lasting well under a frame time was on the stick and settled back to the centre between two of the title's reads: the title never saw it. A slow drag was still held at every read, which is why exactly that case worked and felt like a stick.Fix
Hold the deflection, unchanged, for a time that grows with the distance the mouse moved: 0.3 ms of hold per pixel at sensitivity 1, capped at 180 ms, then a fast 20 ms fall-off. A held deflection is read by as many of the title's frames as the distance is owed, and each of them turns at the stick's rate - so the angle adds up to the mouse distance whatever the title's frame rate. Quick moves and slow moves behave alike, which is what "the mouse works like a mouse in an action game" means on top of a pad-only title.
A reversal puts the stick the other way at once and turns the remaining hold with it. The same-way pile-up (fast continuous drags still reach the full stick), the sensitivity scale, the one-pixel-at-low-sensitivity case and the settle-to-centre are all kept; the existing tests pass unchanged and one new test pins the hold model.
Tuning
HOLD_MS_PER_PX(0.3) andMAX_HOLD_MS(180) are the two knobs; they scale withVICTORY_MOUSE_SENS/ the F1 sensitivity row (#1149). Related: #1002 (the original sensitivity variable).Pull request closed