show distance to marked object

This commit is contained in:
yuni 2024-04-05 22:51:54 +02:00
parent dc077ca141
commit 704c249091

View file

@ -528,7 +528,8 @@ fn update(
if let Some(target_pos) = target {
let dist = pos.0 - target_pos;
let (x, y, z) = (dist.x, dist.y, dist.z);
text.sections[7].value = format!("{x:.0}m / {z:.0}m / {y:.0}m");
let dist_scalar = dist.length();
text.sections[7].value = format!("{x:.0}m / {z:.0}m / {y:.0}m / distance: {dist_scalar:.0}m");
}
else {
text.sections[7].value = format!("ERROR: MULTIPLE TARGETS");