fn user_control_system(
    query: Query<(&mut Ship, &mut Transform, &mut Engine), With<Controlled>>,
    input: Res<Input<KeyCode>>,
    time: Res<Time>,
) {
    let drot: f32 = std::f32::consts::PI * time.delta_seconds();

    query.for_each_mut(|(_ship, mut k_bod, mut eng)| {
        if input.get_pressed().count() == 0 {
            eng.throttle = Throttle::Fixed(false);
        }

        for i in input.get_pressed() {
            match i {
                KeyCode::W | KeyCode::Up => eng.throttle = Throttle::Fixed(true),
                KeyCode::S | KeyCode::Down => eng.throttle = Throttle::Fixed(false),
                KeyCode::A | KeyCode::Left => k_bod.rotate(Quat::from_rotation_z(drot)),
                KeyCode::D | KeyCode::Right => k_bod.rotate(Quat::from_rotation_z(-drot)),
                _ => {}
            }
        }
    })
}
/// Temporary system which give the user control over a ship.
Temporary system which give the user control over a ship.
Temporary system which give the user control over a ship .
fn user_control_system(
    query: Query<(&mut Ship, &mut Transform, &mut Engine), With<Controlled>>,
    input: Res<Input<KeyCode>>,
    time: Res<Time>,
) {
    let drot: f32 = std::f32::consts::PI * time.delta_seconds();
    query.for_each_mut(|(_ship, mut k_bod, mut eng)| {
        if input.get_pressed().count() == 0 {
            eng.throttle = Throttle::Fixed(false);
        }
        for i in input.get_pressed() {
            match i {
                KeyCode::W | KeyCode::Up => eng.throttle = Throttle::Fixed(true),
                KeyCode::S | KeyCode::Down => eng.throttle = Throttle::Fixed(false),
                KeyCode::A | KeyCode::Left => k_bod.rotate(Quat::from_rotation_z(drot)),
                KeyCode::D | KeyCode::Right => k_bod.rotate(Quat::from_rotation_z(-drot)),
                _ => {}
            }
        }
    })
}
fn user_control_system ( query : Query < ( & mut Ship , & mut Transform , & mut Engine ) , With < Controlled > > , input : Res < Input < KeyCode > > , time : Res < Time > , ) { let drot : f32 = std :: f32 :: consts :: PI * time . delta_seconds ( ) ; query . for_each_mut ( | ( _ship , mut k_bod , mut eng ) | { if input . get_pressed ( ) . count ( ) == 0 { eng . throttle = Throttle :: Fixed ( false ) ; } for i in input . get_pressed ( ) { match i { KeyCode :: W | KeyCode :: Up => eng . throttle = Throttle :: Fixed ( true ) , KeyCode :: S | KeyCode :: Down => eng . throttle = Throttle :: Fixed ( false ) , KeyCode :: A | KeyCode :: Left => k_bod . rotate ( Quat :: from_rotation_z ( drot ) ) , KeyCode :: D | KeyCode :: Right => k_bod . rotate ( Quat :: from_rotation_z ( - drot ) ) , _ => { } } } } ) }
Temporary system which give the user control over a ship.
Temporary system which give the user control over a ship .
query
Query<(&mut Ship, &mut Transform, &mut Engine), With<Controlled>>
input
Res<Input<KeyCode>>
time
Res<Time>
query
Query<(&mut Ship, &mut Transform, &mut Engine), With<Controlled>>
input
Res<Input<KeyCode>>
time
Res<Time>