ignore (almost) stationary targets, they're probably ground-bound
This commit is contained in:
@@ -25,7 +25,7 @@ pub fn bogey_dope(
|
||||
mut cmd: ConsoleCommand<BogeyDope>,
|
||||
awacs: Query<&Callsign>,
|
||||
player: Query<(&Callsign, &Position)>,
|
||||
npc: Query<(&Position, &Heading), (Without<Player>, With<Red>)>,
|
||||
npc: Query<(&Position, &Heading, &Velocity), (Without<Player>, With<Red>)>,
|
||||
) {
|
||||
let Some(Ok(BogeyDope)) = cmd.take() else {
|
||||
return;
|
||||
@@ -49,7 +49,11 @@ pub fn bogey_dope(
|
||||
|
||||
let mut distance: f64 = f64::MAX;
|
||||
let mut n = (None, None);
|
||||
for (n_pos, n_heading) in npc.iter() {
|
||||
for (n_pos, n_heading, n_velocity) in npc.iter() {
|
||||
if n_velocity.speed() < 10.0 {
|
||||
// ignore slow/on-ground units
|
||||
continue;
|
||||
}
|
||||
let d = p_pos.distance_to_nmi(n_pos);
|
||||
if d < distance {
|
||||
distance = d;
|
||||
|
||||
Reference in New Issue
Block a user