Rescale Axis and Button value to avoid compression#3464
Rescale Axis and Button value to avoid compression#3464thibaudio wants to merge 10 commits intobevyengine:mainfrom thibaudio:rescale_axis_and_button_value
Conversation
|
I'll update the test later today |
sixfold-origami
left a comment
There was a problem hiding this comment.
Looks pretty nice! I have one nitpick, and a weird edge case to consider
sixfold-origami
left a comment
There was a problem hiding this comment.
This looks really good! Just one question for you
crates/bevy_input/src/gamepad.rs
Outdated
|
|
||
| if let Some(old_value) = old_value { | ||
| if (new_value - old_value).abs() <= self.threshold { | ||
| if (new_value >= 0.0 |
There was a problem hiding this comment.
This needs more comments, or a simpler approach.
There was a problem hiding this comment.
Tried to split this into several smaller functions. Is that better?
There was a problem hiding this comment.
Two changes:
- Add
inlineannotations to the added methods. - The changes on line 203 are far too complex; this needs more comments or preferably structure.
@thibaudio, you can mark comments as resolved by pressing the "Resolve comment" button once they're addressed, which makes it easier for reviewers.
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Thanks for the review @alice-i-cecile |
|
This refactor is definitely an improvement! Spending some time thinking about this, I think the most natural way to model and communicate this in Rust would actually be with: enum AxisPosition {
BelowLowZone,
LowZone,
DeadZone,
HighZone,
AboveHighZone,
}I think that if we start there, we can make this code much easier to read and refactor in the future. Does that make sense to you? |
|
Thanks for your feedback @alice-i-cecile! |
|
Yes, that's lovely! |
|
After toying with that, changing the return type of the |
|
Thanks for letting us know. I'll see about making a PR to your branch with the changes :) |
Objective
Fixes #3450
Solution
Apply the suggested solution to both
AxisSettingspositive/negative values andButtonAxisSettings