mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
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.
This commit is contained in:
parent
bb13d065d3
commit
c8fd390ced
1 changed files with 4 additions and 4 deletions
|
@ -631,10 +631,10 @@ pub struct AxisSettings {
|
|||
impl Default for AxisSettings {
|
||||
fn default() -> Self {
|
||||
AxisSettings {
|
||||
livezone_upperbound: 0.95,
|
||||
livezone_upperbound: 1.0,
|
||||
deadzone_upperbound: 0.05,
|
||||
deadzone_lowerbound: -0.05,
|
||||
livezone_lowerbound: -0.95,
|
||||
livezone_lowerbound: -1.0,
|
||||
threshold: 0.01,
|
||||
}
|
||||
}
|
||||
|
@ -1529,7 +1529,7 @@ mod tests {
|
|||
];
|
||||
|
||||
for (new_value, expected) in cases {
|
||||
let settings = AxisSettings::default();
|
||||
let settings = AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.01).unwrap();
|
||||
test_axis_settings_filter(settings, new_value, None, expected);
|
||||
}
|
||||
}
|
||||
|
@ -1556,7 +1556,7 @@ mod tests {
|
|||
];
|
||||
|
||||
for (new_value, old_value, expected) in cases {
|
||||
let settings = AxisSettings::default();
|
||||
let settings = AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.01).unwrap();
|
||||
test_axis_settings_filter(settings, new_value, old_value, expected);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue