diff --git a/Assets/Scripts/Mechanics/PlayerController.cs b/Assets/Scripts/Mechanics/PlayerController.cs index 5f03c31..f513c92 100644 --- a/Assets/Scripts/Mechanics/PlayerController.cs +++ b/Assets/Scripts/Mechanics/PlayerController.cs @@ -155,13 +155,12 @@ namespace Platformer.Mechanics // PD 지시 2026-05-07 — 낙사 시 복귀할 안전 위치 추적 if (IsGrounded) LastGroundedPosition = transform.position; - - // BT5-Dev #38 — 표준 Drop-Through: 점프 상승(velocity.y > 0) Layer 16 통과·하강(≤0) 충돌 ON - const int JUMP_THROUGH_LAYER = 16; - bool rising = velocity.y > 0.05f; - Physics2D.IgnoreLayerCollision(13, JUMP_THROUGH_LAYER, rising); } + // BT5-Dev #39 — 점프 시작 시 Coroutine으로 0.3초 동안 Layer 16 통과 유지 (Physics step 지연 차단) + const int JUMP_THROUGH_LAYER = 16; + bool _jumpThroughActive; + void UpdateJumpState() { jump = false; @@ -171,6 +170,8 @@ namespace Platformer.Mechanics jumpState = JumpState.Jumping; jump = true; stopJump = false; + // BT39 — 점프 시작 시 즉시 IgnoreLayerCollision 활성 + Coroutine으로 0.3초 유지 + if (!_jumpThroughActive) StartCoroutine(JumpThroughRoutine()); break; case JumpState.Jumping: if (!IsGrounded) @@ -192,6 +193,15 @@ namespace Platformer.Mechanics } } + System.Collections.IEnumerator JumpThroughRoutine() + { + _jumpThroughActive = true; + Physics2D.IgnoreLayerCollision(13, JUMP_THROUGH_LAYER, true); + yield return new WaitForSeconds(0.3f); + Physics2D.IgnoreLayerCollision(13, JUMP_THROUGH_LAYER, false); + _jumpThroughActive = false; + } + protected override void ComputeVelocity() { if (jump && IsGrounded)