From 40c0509e02871073fed205c28db76e7f1efafd60 Mon Sep 17 00:00:00 2001 From: swrring Date: Fri, 8 May 2026 00:37:58 +0900 Subject: [PATCH] =?UTF-8?q?BT5-Dev=20#73:=20footHit=203=EC=A0=90=20Raycast?= =?UTF-8?q?=20(=EB=B0=9C=ED=8C=90=20=EA=B0=80=EC=9E=A5=EC=9E=90=EB=A6=AC?= =?UTF-8?q?=20jitter=20=EC=A0=95=EC=A0=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 + 발판 방향 이동) --- Assets/Scripts/Mechanics/PlayerController.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Mechanics/PlayerController.cs b/Assets/Scripts/Mechanics/PlayerController.cs index 8bc7153..ebd0c06 100644 --- a/Assets/Scripts/Mechanics/PlayerController.cs +++ b/Assets/Scripts/Mechanics/PlayerController.cs @@ -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 (통과)