From 87e455827c0c563da6dcd74ab2afdbd1fc725f27 Mon Sep 17 00:00:00 2001 From: Stedd Date: Sat, 5 Oct 2024 19:38:26 +0200 Subject: [PATCH] Fixed weapon debug ray --- Scripts/Weapon.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/Weapon.cs b/Scripts/Weapon.cs index 9115fb1..f4e052e 100644 --- a/Scripts/Weapon.cs +++ b/Scripts/Weapon.cs @@ -27,12 +27,13 @@ namespace GameDev.CoreSystems var position = BarrelEndPoint.position; var forward = BarrelEndPoint.forward; var ray = new Ray(position, forward); - Debug.DrawRay(position, forward * 10, Color.green); if (Physics.Raycast(ray, out RaycastHit hitInfo)) { if (hitInfo.transform.TryGetComponent(out Targetable target)) { + Debug.DrawRay(position, forward * Vector3.Distance(position, target.GetCenterPosition()), + Color.red, 0.1f); target.Damageable.ModifyHealth(Mathf.RoundToInt(-Damage)); } }