diff --git a/Assets/Scripts/Mechanics/PlayerController.cs b/Assets/Scripts/Mechanics/PlayerController.cs index bbe07a5..93041fa 100644 --- a/Assets/Scripts/Mechanics/PlayerController.cs +++ b/Assets/Scripts/Mechanics/PlayerController.cs @@ -203,9 +203,19 @@ namespace Platformer.Mechanics void UpdateContactFilterForDropThrough() { int baseMask = Physics2D.GetLayerCollisionMask(gameObject.layer); - // BT41 — jumpState == Jumping 영역 영역 ascending true (PrepareToJump frame 직후 velocity.y 미반영 영역도 통과) - bool ascending = velocity.y > 0.01f || jumpState == JumpState.Jumping; - int mask = ascending ? (baseMask & ~(1 << JUMP_THROUGH_LAYER)) : baseMask; + + // BT5-Dev #42 — PD 의도: 발판 위 착지(서있는) 영역만 충돌 ON, 걷기·점프·측면 영역 모두 통과 + bool standingOnPlatform = false; + if (collider2d != null && IsGrounded) + { + Vector2 footPos = new Vector2(collider2d.bounds.center.x, collider2d.bounds.min.y + 0.02f); + int jumpThroughMask = 1 << JUMP_THROUGH_LAYER; + RaycastHit2D footHit = Physics2D.Raycast(footPos, Vector2.down, 0.1f, jumpThroughMask); + standingOnPlatform = footHit.collider != null; + } + + // standingOnPlatform=true → Layer 16 ON (착지·서있는 영역 영역 X) / 그 외 → Layer 16 OFF (통과) + int mask = standingOnPlatform ? baseMask : (baseMask & ~(1 << JUMP_THROUGH_LAYER)); contactFilter.SetLayerMask(mask); contactFilter.useLayerMask = true; }