Skip to content

Commit c8fd390

Browse files
Change AxisSettings livezone default (#10090)
# Objective While using joysticks for player aiming, I noticed that there was as `0.05` value snap on the axis. After searching through Bevy's code, I saw it was the default livezone being at `0.95`. This causes any value higher to snap to `1.0`. I think `1.0` and `-1.0` would be a better default, as it gives all values to the joystick arc. This default livezone stumped me for a bit as I thought either something was broken or I was doing something wrong. ## Solution Change the livezone defaults to ` livezone_upperbound: 1.0` and `livezone_lowerbound: -1.0`. --- ## Migration Guide If the default 0.05 was relied on, the default or gamepad `AxisSettings` on the resource `GamepadSettings` will have to be changed.
1 parent bb13d06 commit c8fd390

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/bevy_input/src/gamepad.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,10 @@ pub struct AxisSettings {
631631
impl Default for AxisSettings {
632632
fn default() -> Self {
633633
AxisSettings {
634-
livezone_upperbound: 0.95,
634+
livezone_upperbound: 1.0,
635635
deadzone_upperbound: 0.05,
636636
deadzone_lowerbound: -0.05,
637-
livezone_lowerbound: -0.95,
637+
livezone_lowerbound: -1.0,
638638
threshold: 0.01,
639639
}
640640
}
@@ -1529,7 +1529,7 @@ mod tests {
15291529
];
15301530

15311531
for (new_value, expected) in cases {
1532-
let settings = AxisSettings::default();
1532+
let settings = AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.01).unwrap();
15331533
test_axis_settings_filter(settings, new_value, None, expected);
15341534
}
15351535
}
@@ -1556,7 +1556,7 @@ mod tests {
15561556
];
15571557

15581558
for (new_value, old_value, expected) in cases {
1559-
let settings = AxisSettings::default();
1559+
let settings = AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.01).unwrap();
15601560
test_axis_settings_filter(settings, new_value, old_value, expected);
15611561
}
15621562
}

0 commit comments

Comments
 (0)