-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to configure gamepads #3246
Comments
I want to take this issue but this example dont working with my xbox one controller: What i should look? |
@vabka, I would start by filing an issue that your gamepad support isn't working :) That's another serious problem that we should investigate separately, in one form or another. Then, I would start by opening a PR to add a new example. Feel free to skim https://github.com/bevyengine/bevy/blob/main/CONTRIBUTING.md if you need guidance. You can test your example without a gamepad by mocking the inputs:
Once you're ready, put up your PR and we can verify that it works on physical controllers. |
@cart Yeah. |
I have a question about ButtonSettings.
|
These are very good questions, and the answers should be documented on ButtonSettings as part of a fix to this issue. However, I don't immediately know the answers! My initial testing on an XBox controller suggested that the inputs were either 0.0 or 1.0: in which case exposing a f32 is silly. However, that is not consistent with the existence of |
For 3: the logic is very simple: impl ButtonSettings {
fn is_pressed(&self, value: f32) -> bool {
value >= self.press
}
fn is_released(&self, value: f32) -> bool {
value <= self.release
}
} |
We appear to be getting these values from bevy/crates/bevy_input/src/gamepad.rs Line 42 in e48f9d8
These are generated from the
and then converted from bevy/crates/bevy_input/src/gamepad.rs Line 268 in e48f9d8
So, why is The data is stored in the pub enum EventType {
ButtonPressed(EvCode),
ButtonReleased(EvCode),
AxisValueChanged(i32, EvCode),
Connected,
Disconnected,
} That's very suspicious: there's no f32s to be found there... And from their docs, an Doing a quick search, I can see: https://github.com/Arvamer/gilrs/blob/952d22ce3bef4e11f594fa64b7309ce79d9a9a79/gilrs/src/ev/state.rs#L44, which returns a f32 for all of the Here we go: if pressed { 1.0 } else { 0.0 }, However, that isn't used for analogue buttons (generally, triggers are the only analogue buttons). So ultimately our answers are:
|
#3692 might be relevant to take into consideration. I extended the documentation for the |
Ooo. I could get my controller out of the box. I'll pick this up 🕹️ |
Oh, except #12770. Hrm. Hit pause on that one I guess. |
How can Bevy's documentation be improved?
GamepadInputSettings
is somewhat challenging to figure out how to use. A simple example system would go a long way.The text was updated successfully, but these errors were encountered: