From 704c249091548d727e1041856ed0708a66c06506 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 5 Apr 2024 22:51:54 +0200 Subject: [PATCH] show distance to marked object --- src/hud.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hud.rs b/src/hud.rs index 7714edd..57ba698 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -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");