BT5-Dev #73: footHit 3점 Raycast (발판 가장자리 jitter 정정)

PD 보고 (2026-05-08): "발판 끝에서 내려오기 직전 아래 방향 유지 + 발판방향 이동 시 밀려남"

진단:
- BT72 후도 descending 시 standingOnPlatform 검사 활성
- footHit Raycast 단일 (중앙) 영역 = 발판 가장자리 진입 시 검출 X·검출 O frame 교차
- = jitter (mask ON·OFF 진동) → 미세 밀려남

정정 (BT73):
- footHit Raycast 좌·중·우 3점 추가
  - footY = collider2d.bounds.min.y + 0.02f
  - boundsLeft = collider2d.bounds.min.x + 0.02f
  - boundsCenter = collider2d.bounds.center.x
  - boundsRight = collider2d.bounds.max.x - 0.02f
- standingOnPlatform = 3점 OR 결합 (어느 하나라도 검출 시 true)
- = 발판 가장자리 영역 안정 검출

효과:
- 발판 가장자리 영역 진입 시 standingOnPlatform 안정 (jitter 차단)
- 발판 위 착지 정합 (3점 중 1점 검출 영역 충분)
- ascending·Drop-Through·일반 점프 영역 그대로

후속 의무:
- PD Refresh+Play 시각 검증 (특수 재현 경로 — 발판 끝 + Down + 발판 방향 이동)
This commit is contained in:
깃 관리자 2026-05-08 00:37:58 +09:00
parent 06e92a8732
commit 40c0509e02
1 changed files with 11 additions and 3 deletions

View File

@ -251,10 +251,18 @@ namespace Platformer.Mechanics
bool standingOnPlatform = false;
if (collider2d != null && !isJumpingThrough)
{
Vector2 footPos = new Vector2(collider2d.bounds.center.x, collider2d.bounds.min.y + 0.02f);
// BT73 — footHit Raycast 3점 (좌·중·우) (PD 보고 2026-05-08: 발판 가장자리 jitter)
// 단일 중앙 Raycast 시 가장자리 영역 검출 X·검출 O frame 교차 → 밀려남
// 좌·중·우 3점 어느 하나라도 검출 시 standingOnPlatform=true → 안정
float footY = collider2d.bounds.min.y + 0.02f;
float boundsLeft = collider2d.bounds.min.x + 0.02f;
float boundsCenter = collider2d.bounds.center.x;
float boundsRight = collider2d.bounds.max.x - 0.02f;
int jumpThroughMask = 1 << JUMP_THROUGH_LAYER;
RaycastHit2D footHit = Physics2D.Raycast(footPos, Vector2.down, 0.1f, jumpThroughMask);
standingOnPlatform = footHit.collider != null;
RaycastHit2D footHitC = Physics2D.Raycast(new Vector2(boundsCenter, footY), Vector2.down, 0.1f, jumpThroughMask);
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;
}
// standingOnPlatform=true → Layer 16 ON (착지·서있는 영역 영역 X) / 그 외 → Layer 16 OFF (통과)