ignore (almost) stationary targets, they're probably ground-bound

This commit is contained in:
AviiNL
2023-12-28 12:40:27 +01:00
parent a11402e763
commit f0f0d0c550
6 changed files with 33 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ fn tripwire(
mut commands: Commands,
awacs: Query<(Entity, &Callsign, &Radio), (With<Awacs>, With<Blue>, With<Radio>)>,
mut players: Query<(&Callsign, &Position, &RadioInfo, &mut Tripwire), With<Player>>,
npc: Query<(&Id, &Position, &Heading), (Without<Player>, With<Red>)>,
npc: Query<(&Id, &Position, &Heading, &Velocity), (Without<Player>, With<Red>)>,
) {
// get the players radio frequencies
// match the tuned frequency with one of the awacs'
@@ -44,9 +44,9 @@ fn tripwire(
continue;
}
for (n_id, n_position, n_heading) in npc.iter() {
if n_position.angels() == 0 {
// ignore on-ground units
for (n_id, n_position, n_heading, n_velocity) in npc.iter() {
if n_velocity.speed() < 10.0 {
// ignore slow/on-ground units
continue;
}
let distance = n_position.distance_to_nmi(p_position);