keyboard_input.just_pressed
in basic_dynamic_character
example works only sometimes
#170
Labels
C-Examples
Improvements or additions to examples
Very new to bevy_xpbd, I hope this is not a silly question..
What I did:
run the "basic_dynamic_character" example in release mode
cargo run --example basic_dynamic_character --release
and then press space/jump multiple times.
What I expected to happen:
the capsule/character should jump every time I press space, as long as it touches the ground when pressing.
What happened:
the jump happens only sometimes, seems random at first.
I think the problem is that the system responsible for keyboard input handling is running on the physics schedule and therefore
.just_pressed()
is not working as expected (keys are not just pressed anymore in most cases but only pressed).All other buttons are working fine, as well as the grounded condition. Also: when changing the line to
if keyboard_input.pressed(KeyCode::Space) && !ground_hits.is_empty() {
the jumping works as intended.
Is it just me that I am not familiar enough with bevy_xpbd to know what I should do in such cases or should the example be "fixed"?
The text was updated successfully, but these errors were encountered: