Keyboard/mouse: the camera whips after the title stops reading the gamepad for over 100 ms #957
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 ivall/xcl. Originally posted by Conrage on 2026-11-24T09:36:28Z.
kbm::applypasses all mouse counts gathered since the previous call toVelocity::updatewith the elapseddt, andupdateclampsdtto 0.1 s before dividing:github.com/ivall/xcl@077ce40/crates/xcl/src/hle/kbm.rs (L433-L436)github.com/ivall/xcl@077ce40/crates/xcl/src/hle/kbm.rs (L74-L78)If the title doesn't read the gamepad for 2 s (a loading screen, a hitch) while the mouse moves at 1,000 counts/s, the 2,000 counts are treated as arriving in 0.1 s: 20,000 counts/s. With the smoothing factor at dt = 0.1 (about 0.96), the velocity jumps to about 19,300 counts/s, almost five times full deflection (4,000). It stays at full deflection for about three frames before it settles, so the camera whips.
Repro (unit test):
Suggested fix: compute the rate with the real
dt(clamping only the smoothing factor), or drop counts gathered before the clamp window.Not tested: worked out from the code; the test above was not run and it was not seen in a game.
AI use: found, checked and written up by Claude Code (Claude Opus 5.5) at my request.
Imported from ivall/xcl. Originally posted by DTsordas on 2026-11-24T09:38:44Z.
Confirmed on main
077ce40with a unit test:Velocity::update(300, -150, 0.3)(1000 counts/s over a 300 ms hitch) givesVelocity { x: 2892.978, y: -1446.489 }instead of about 1000 / -500, so atmouse_sensitivity = 1the right stick goes to 0.76 instead of 0.36.I have the fix your issue suggests: the rate over the real
dt, with only the lower bound kept (dt.max(0.001)). The upper bound guarded nothing else, since the smoothing weight is at most 1 for anydtand the wheel clamps its own. With that test, the full suite passes on an RX 9060 XT (debug,cargo test --workspace -- --test-threads=4: 717 passed, 0 failed, 41 ignored, 0 SKIPPED). I'll open the PR (Fixes #963) once I have the smoke runs on a title, unless you already have one.AI use: Claude Code (Claude Opus 5.5) ran the test and wrote this comment.
upstream-sync referenced this issue2026-11-25 07:04:28 +00:00