BT5-Dev #67: AutoForeground transform 동기화 — y+1 시각 영역 정정

PD 보고 (2026-05-08): "발판의 위치가 1만큼 y로 올라갔는데 왜 그런거지?"

근본 원인:
- BT66 R2 — AutoForeground GameObject 신규 생성 (Grid 자식)
- 신규 생성 시 transform.localPosition = default (0, 0, 0)
- PD가 Level·Foreground GameObject를 y=-1로 직접 변경 (PD 시각 정정 작업)
- = AutoForeground (y=0) ↔ Level/Foreground (y=-1) → 1m 차이로 시각상 위로

정정 (1행 추가):
- 매 Play 시점 AutoForeground.transform.localPosition = PD Foreground localPosition (또는 Level)
- PD Foreground 우선 (가림막 영역과 동일 공간 보장) · 미존재 시 Level fallback

효과:
- AutoForeground 발판 시각 위치 = PD Foreground·Level 영역과 동일
- Drop-Through 패턴 작동 영역 동일 (Layer 16 + ContactFilter mask)
- 발판 위 착지 좌표 정합 (Player 영역과 정합)

후속 의무:
- PD Refresh+Play 시각 검증
- BT67 commit으로 R2 영역 완결
This commit is contained in:
깃 관리자 2026-05-08 00:14:59 +09:00
parent 32fa2d4b07
commit 835f572e95
1 changed files with 5 additions and 0 deletions

View File

@ -96,6 +96,11 @@ namespace Platformer.Mechanics
if (autoFg != null) if (autoFg != null)
{ {
autoFg.layer = 16; autoFg.layer = 16;
// BT67 — PD 보고 (2026-05-08): "발판의 위치가 1만큼 y로 올라갔는데 왜 그런거지?"
// 원인: AutoForeground 신규 생성 시 transform default (0,0,0) ↔ PD가 Level/Foreground를 y=-1로 직접 변경
// 정정: 매 Play 시점 PD Foreground(또는 Level) localPosition와 동기화
var refGo = pdForeground != null ? pdForeground : GameObject.Find("Level");
if (refGo != null) autoFg.transform.localPosition = refGo.transform.localPosition;
fgTilemap = autoFg.GetComponent<UnityEngine.Tilemaps.Tilemap>(); fgTilemap = autoFg.GetComponent<UnityEngine.Tilemaps.Tilemap>();
if (fgTilemap == null) fgTilemap = autoFg.AddComponent<UnityEngine.Tilemaps.Tilemap>(); if (fgTilemap == null) fgTilemap = autoFg.AddComponent<UnityEngine.Tilemaps.Tilemap>();
if (autoFg.GetComponent<UnityEngine.Tilemaps.TilemapRenderer>() == null) if (autoFg.GetComponent<UnityEngine.Tilemaps.TilemapRenderer>() == null)