From 5e796cc5e241522d87b9e3a9e739e844dd7e1bda Mon Sep 17 00:00:00 2001 From: swrring Date: Thu, 7 May 2026 17:29:30 +0900 Subject: [PATCH] =?UTF-8?q?BT5-Dev=20#32:=20PlatformDropThrough=20Awake/St?= =?UTF-8?q?art=20=EC=A7=84=EB=8B=A8=20=EB=A1=9C=EA=B7=B8=20+=20raycast=20?= =?UTF-8?q?=EB=AC=B4=ED=95=9C=EB=8C=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [BT31-StartHit] 출력 0건 진단: 1. PlatformDropThrough 부착 X 또는 Awake/Start 호출 X 2. Start raycast 거리 0.5m 이내 발판 X (Player 시작 위치 발판 멀리) 진단 영역: - Awake: [BT32-DropThrough] self/ko/mask 출력 - Start: [BT32-DropThrough] Start called + raycast 결과 출력 - hit Layer 8: [BT32-StartHit] dist·platform name·layer - miss: [BT32-StartHit] no Layer 8 + 모든 Layer raycast로 anyHit 출력 - raycast 거리 무한대 (Mathf.Infinity) --- .../Scripts/Mechanics/PlatformDropThrough.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Mechanics/PlatformDropThrough.cs b/Assets/Scripts/Mechanics/PlatformDropThrough.cs index a63836f..8765b3c 100644 --- a/Assets/Scripts/Mechanics/PlatformDropThrough.cs +++ b/Assets/Scripts/Mechanics/PlatformDropThrough.cs @@ -26,19 +26,31 @@ namespace Platformer.Mechanics _self = GetComponent(); _ko = GetComponent(); _jumpThroughMask = 1 << JUMP_THROUGH_LAYER; + Debug.Log($"[BT32-DropThrough] Awake — self={(_self != null ? "OK" : "NULL")} ko={(_ko != null ? "OK" : "NULL")} mask={_jumpThroughMask}"); } void Start() { - // BT5-Dev #31 — 게임 시작 시 즉시 raycast 1회 → Player 시작 위치가 발판 위면 즉시 충돌 활성 (떨어짐 차단) + Debug.Log($"[BT32-DropThrough] Start called"); if (_self == null) return; Vector2 footPos = new Vector2(_self.bounds.center.x, _self.bounds.min.y + 0.02f); - RaycastHit2D startHit = Physics2D.Raycast(footPos, Vector2.down, footRayDistance, _jumpThroughMask); + // BT32 — 거리 무한대 = Player 시작 위치 영역 발판 영역 영역 식별 + RaycastHit2D startHit = Physics2D.Raycast(footPos, Vector2.down, Mathf.Infinity, _jumpThroughMask); if (startHit.collider != null) { Physics2D.IgnoreCollision(_self, startHit.collider, false); _activePlatform = startHit.collider; - Debug.Log($"[BT31-StartHit] Player 시작 위치 발판 영역 충돌 활성: {startHit.collider.gameObject.name}"); + Debug.Log($"[BT32-StartHit] dist={startHit.distance:F2} platform='{startHit.collider.gameObject.name}' layer={startHit.collider.gameObject.layer}"); + } + else + { + Debug.Log($"[BT32-StartHit] no Layer 8 platform below footPos={footPos} (mask={_jumpThroughMask})"); + // 마지막 수단 — 모든 Layer raycast해서 가장 가까운 영역 식별 + RaycastHit2D anyHit = Physics2D.Raycast(footPos, Vector2.down, Mathf.Infinity); + if (anyHit.collider != null) + Debug.Log($"[BT32-AnyHit] anyLayer dist={anyHit.distance:F2} platform='{anyHit.collider.gameObject.name}' layer={anyHit.collider.gameObject.layer}"); + else + Debug.Log($"[BT32-AnyHit] NOTHING below player"); } }