Open
Description
Bevy version
bevy = { version = "0.15", features = ["dynamic_linking"] }
bevy_panorbit_camera = "0.23.0"
bevy_rapier3d = "0.29.0"
[Optional] Relevant system information
Ubuntu 24.04.2 LTS
cargo 1.85.0 (d73d2caf9 2024-12-31)
What you did
I got a player controller, but when I try to jump while pressing ArrowUp
+ ArrowLeft
+ Space
it does not jump. However it does work when I press any other combination (e.g. ArrowUp
+ ArrowRight
+ Space
). The weird part is that it does the same on the second player with KeyW
+ KeyA
+ KeyQ
. It does look into a bug on my side but if I map the jump to KeyP
for instance, it works well.
impl Team {
fn get_key_map(&self) -> KeyMap {
match self {
Self::Blue => KeyMap {
jump: KeyCode::Space,
left: KeyCode::ArrowLeft,
right: KeyCode::ArrowRight,
up: KeyCode::ArrowUp,
down: KeyCode::ArrowDown,
},
Self::Red => KeyMap {
jump: KeyCode::KeyQ,
left: KeyCode::KeyA,
right: KeyCode::KeyD,
up: KeyCode::KeyW,
down: KeyCode::KeyS,
},
}
}
}
fn inputs_system(
keys: Res<ButtonInput<KeyCode>>,
mut players: Query<(&mut Player, &KinematicCharacterControllerOutput)>,
) {
const SPEED: f32 = 3.0;
for (mut player, output) in players.iter_mut() {
player.direction = Vec2::ZERO;
let key_map = player.team.get_key_map();
if keys.just_pressed(key_map.jump) && output.grounded {
player.vertical_velocity = 0.5 * GRAVITY;
}
player.direction = Vec2::ZERO;
if keys.pressed(key_map.left) {
player.direction.x = -SPEED;
}
if keys.pressed(key_map.right) {
player.direction.x = SPEED;
}
if keys.pressed(key_map.up) {
player.direction.y = -SPEED;
}
if keys.pressed(key_map.down) {
player.direction.y = SPEED;
}
}
}
pressed
instead of just_pressed
does the same thing.
I'm just starting bevy, like from yesterday. I could have missed something.
Thanks everyone