Match IW4x controller turn acceleration

The turn-speed limit scaled with sensitivity while acceleration scaled
with FOV. Increasing sensitivity therefore lengthened the ramp, unlike
the local IW4x controller implementation.

Scale acceleration by the base controller sensitivity multiplier instead
of FOV, matching IW4x's default 1200 degrees/s squared times sensitivity.
Keep ADS and FOV scaling on the requested turn speed. Ramp the absolute
speed before applying the requested direction, matching IW4x's integrator
when the stick reverses direction during a ramp. Deceleration and disabled
acceleration remain immediate.

Validation: the play build, targeted rustfmt and diff checks passed.
A temporary reference probe passed 216 combinations of sensitivity, FOV,
ADS blend, frame rate and acceleration mode, including direction reversals,
release and disabling acceleration. No game relaunch or physical-controller
feel test was performed.
This commit is contained in:
awsms
2026-10-01 07:42:51 +02:00
parent 72b4c08c33
commit b7661e1a0a
+5 -10
View File
@@ -171,16 +171,11 @@ pub fn pad_look_frame(
let wanted = [-input.pad_look[1] * max_pitch, -input.pad_look[0] * max_yaw];
for (rate, goal) in input.pad_turn_rate.iter_mut().zip(wanted) {
if input.pad_acceleration
&& ((goal.abs() > rate.abs() && goal.signum() == rate.signum())
|| (*rate == 0.0 && goal != 0.0))
{
let step = TURN_ACCEL * zoom * dt;
*rate = if goal > *rate {
(*rate + step).min(goal)
} else {
(*rate - step).max(goal)
};
if input.pad_acceleration && goal.abs() > rate.abs() {
// IW4x ramps speed magnitude, then applies the requested direction.
// Acceleration follows base sensitivity, independently of FOV and ADS.
let step = TURN_ACCEL * input.pad_sensitivity * dt;
*rate = (rate.abs() + step).min(goal.abs()) * goal.signum();
} else {
*rate = goal;
}