BT5-Dev #74: 발판 가장자리 밀림 시 강제 Drop-Through (PD 권고 채택)

PD 권고 (2026-05-08): "한번이라도 밀리면 아래로 강제로 떨구어야하지 않을까?"

진단:
- BT73 후 footHit 3점 안정화에도 특수 영역 잔존
- 점프 정점(velocity.y ≈ 0) + 수평 이동 시도 + 발판 가장자리 = 발판 일시 검출
- = standingOnPlatform=true → mask ON → body.Cast 충돌 → 수평·수직 정지
- = '밀린 상태 고정'

정정 (BT74 — UpdateContactFilterForDropThrough 영역 추가):
밀림 상태 검출 4조건 AND 결합:
1. standingOnPlatform=true (footHit 3점 검출)
2. inAir = jumpState == Jumping || jumpState == InFlight (점프·낙하 중)
3. nearApex = velocity.y > -1.5f (정점·낙하 초기)
4. horizontalIntent = Mathf.Abs(move.x) > 0.1f (수평 이동 시도)

검출 시 강제 Drop-Through:
- dropThroughTimer = DROP_THROUGH_DURATION (0.3초 mask 강제 OFF)
- standingOnPlatform = false (즉시 해제)
- = Player 발판 통과 + 자연 낙하 시작

효과:
- 발판 가장자리 정점 + 수평 이동 시 = 강제 통과 (밀림 X)
- 정상 착지 (velocity.y < -1.5 빠른 descending) = 영역 외 → 그대로 착지
- 발판 위 정지 (Grounded·수평 입력 X) = 영역 외 → 그대로
- ascending·Drop-Through·일반 점프 = 그대로

후속 의무:
- PD Refresh+Play 시각 검증 (특수 재현 경로 + 다양한 점프 영역)
This commit is contained in:
깃 관리자 2026-05-08 00:43:25 +09:00
parent 40c0509e02
commit 5b199cbe6f
1 changed files with 12 additions and 0 deletions

View File

@ -263,6 +263,18 @@ namespace Platformer.Mechanics
RaycastHit2D footHitL = Physics2D.Raycast(new Vector2(boundsLeft, footY), Vector2.down, 0.1f, jumpThroughMask);
RaycastHit2D footHitR = Physics2D.Raycast(new Vector2(boundsRight, footY), Vector2.down, 0.1f, jumpThroughMask);
standingOnPlatform = footHitC.collider != null || footHitL.collider != null || footHitR.collider != null;
// BT74 — 밀림 상태 강제 Drop-Through (PD 권고 2026-05-08: "한번이라도 밀리면 아래로 강제로 떨구어야")
// 점프·낙하 중 정점 영역(velocity.y > -1.5) + 수평 입력 + 발판 가장자리 일시 검출 = 밀림 상태
// → dropThroughTimer 강제 활성 + standingOnPlatform=false 즉시 해제
bool inAir = jumpState == JumpState.Jumping || jumpState == JumpState.InFlight;
bool nearApex = velocity.y > -1.5f;
bool horizontalIntent = Mathf.Abs(move.x) > 0.1f;
if (standingOnPlatform && inAir && nearApex && horizontalIntent)
{
dropThroughTimer = DROP_THROUGH_DURATION;
standingOnPlatform = false;
}
}
// standingOnPlatform=true → Layer 16 ON (착지·서있는 영역 영역 X) / 그 외 → Layer 16 OFF (통과)