From a34c1ebe91bdf70510fac0b388b00b3c05a82c55 Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Thu, 03 Apr 2025 13:15:24 +0000
Subject: [PATCH] #43 fixed drilling down

---
 Assets/Scripts/Managers/GameManager.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs
index 524a68a..9f4d5ed 100644
--- a/Assets/Scripts/Managers/GameManager.cs
+++ b/Assets/Scripts/Managers/GameManager.cs
@@ -144,7 +144,10 @@
                 cellCoord.x = cellCoord.x + 1;
                 break;
             case DrillDirection.Down:
-                cellCoord.y = cellCoord.y - 1;
+                // Use player's center position for downward drilling
+                Vector3 playerCenter = contact.rigidbody.transform.position;
+                cellCoord = grid.WorldToCell(playerCenter);
+                cellCoord.y = grid.WorldToCell(contact.point).y - 1; // Keep the vertical position from contact point
                 break;
         }
 

--
Gitblit v1.9.3