From 8799c4f8f486f5f50dca1281f4d02f776b6c8fc5 Mon Sep 17 00:00:00 2001 From: dal4segno Date: Tue, 27 Jan 2026 23:01:21 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B1=B4=EC=84=A4=20=EC=8B=9C=20=EB=AA=A8?= =?UTF-8?q?=EB=93=A0=20=EC=98=A4=EB=B8=8C=EC=A0=9D=ED=8A=B8=EC=99=80=20?= =?UTF-8?q?=EC=B6=A9=EB=8F=8C=20=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/BuildingManager.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Assets/Scripts/BuildingManager.cs b/Assets/Scripts/BuildingManager.cs index eacdb03..d243967 100644 --- a/Assets/Scripts/BuildingManager.cs +++ b/Assets/Scripts/BuildingManager.cs @@ -108,6 +108,26 @@ namespace Northbound return false; } + // 물리적 충돌 체크 (플레이어, 유닛, 기타 오브젝트와의 충돌) + // Physics.OverlapBox를 사용하여 해당 위치에 다른 Collider가 있는지 확인 + Collider[] colliders = Physics.OverlapBox( + boundsCenter, + shrunkSize * 0.5f, + Quaternion.Euler(0, rotation * 90f, 0), + ~groundLayer // groundLayer를 제외한 모든 레이어와 충돌 검사 + ); + + // 충돌한 Collider가 있으면 배치 불가 + if (colliders.Length > 0) + { + Debug.Log($"[BuildingManager] 물리적 충돌 감지: {colliders.Length}개의 오브젝트와 겹침"); + foreach (var col in colliders) + { + Debug.Log($" - {col.gameObject.name} (Layer: {LayerMask.LayerToName(col.gameObject.layer)})"); + } + return false; + } + return true; }