BT5-Dev #32: PlatformDropThrough Awake/Start 진단 로그 + raycast 무한대

[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)
This commit is contained in:
깃 관리자 2026-05-07 17:29:30 +09:00
parent 0eea12d945
commit 5e796cc5e2
1 changed files with 15 additions and 3 deletions

View File

@ -26,19 +26,31 @@ namespace Platformer.Mechanics
_self = GetComponent<Collider2D>(); _self = GetComponent<Collider2D>();
_ko = GetComponent<KinematicObject>(); _ko = GetComponent<KinematicObject>();
_jumpThroughMask = 1 << JUMP_THROUGH_LAYER; _jumpThroughMask = 1 << JUMP_THROUGH_LAYER;
Debug.Log($"[BT32-DropThrough] Awake — self={(_self != null ? "OK" : "NULL")} ko={(_ko != null ? "OK" : "NULL")} mask={_jumpThroughMask}");
} }
void Start() void Start()
{ {
// BT5-Dev #31 — 게임 시작 시 즉시 raycast 1회 → Player 시작 위치가 발판 위면 즉시 충돌 활성 (떨어짐 차단) Debug.Log($"[BT32-DropThrough] Start called");
if (_self == null) return; if (_self == null) return;
Vector2 footPos = new Vector2(_self.bounds.center.x, _self.bounds.min.y + 0.02f); 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) if (startHit.collider != null)
{ {
Physics2D.IgnoreCollision(_self, startHit.collider, false); Physics2D.IgnoreCollision(_self, startHit.collider, false);
_activePlatform = startHit.collider; _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");
} }
} }