Replies: 1 comment 2 replies
-
There's still an issue #6183 when you use So if you want to use fn handle_input(
mut keys: Local<Input<KeyCode>>,
mut keyboard_input_events: EventReader<KeyboardInput>,
) {
keys.clear();
for event in keyboard_input_events.read() {
if let Some(key_code) = event.key_code {
match event.state {
ButtonState::Pressed => keys.press(key_code),
ButtonState::Released => keys.release(key_code),
}
}
}
// do something with inputs
let up = keys.pressed(KeyCode::Up);
let down = keys.pressed(KeyCode::Down);
let left = keys.pressed(KeyCode::Left);
let right = keys.pressed(KeyCode::Right);
let respawn = keys.just_pressed(KeyCode::Return);
} You fill If you want to use this with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone!
I would like to understand the interaction of
Input<_>
(key codes in particular) and FixedUpdate systems. What is the correct way of scheduling input processing when the main game logic uses FixedUpdate for physics simulations?just_pressed
et al., even if FixedUpdate runs more than once in a single App update? What happens if the user presses a button between two FixedUpdate schedules within the same App update?Currently, I have input processing in FixedUpdate which seems to work alright. Is that the correct way of doing it?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions