Skip to content

Commit cceabaa

Browse files
authored
renderer: kit pillar grounding — seat bounds min.y on floor (r6, #83) (#1685)
* renderer: kit pillar grounding — seat bounds min.y on the floor (r6) PlacePillar's y-term (pivotOffset.y - b1.min.y) double-counts the bounds centre for base-pivot meshes: Synty pillars (pivot at base, centre.y=+2.0 after scaling) landed at pos.y=-1.98 with world bounds -1.99..2.01 — half the column underground, reading as a short stub despite achieved size (1.20, 4.00, 1.20) being exactly on target. Fix: ground on min.y alone (position.y - b1.min.y). Box-verified live: all 4 pillars now minY=0.00 maxY=4.00; capture kit_crypt_20260722T1538Z shows full-height columns. Part of #83 / #84 navigation-truth spike. * renderer: CaptureRoom also emits the 1344x768 contract frame (r6) qa/registration_score.py refuses non-contract sizes (its projection is defined in the 1344x768 frame); the 2560x1600 review render alone could not be scored. One capture op now writes both files.
1 parent 5d357db commit cceabaa

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

extensions/renderers/unity/scripts/build_room_kit.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,19 +381,24 @@ public static void CaptureRoom()
381381
foreach (var ll in UnityEngine.Object.FindObjectsByType<Light>(FindObjectsSortMode.None))
382382
{ if (ll == null || ll.transform.IsChildOf(root.transform)) continue; if (ll.enabled) { ll.enabled = false; disLights.Add(ll); } }
383383

384-
string outPath = null;
384+
string outPath = null; string contractPath = null;
385385
try
386386
{
387387
string stamp = DateTime.UtcNow.ToString("yyyyMMdd'T'HHmm'Z'", CultureInfo.InvariantCulture);
388388
outPath = Path.Combine(CaptureDir(), $"kit_{roomId}_{stamp}.png");
389389
RenderToPng(cam, W, H, outPath);
390+
// r6: ALSO emit the 1344x768 CONTRACT frame — qa/registration_score.py refuses any other
391+
// size (its projection math is defined in that frame), so every capture yields both.
392+
contractPath = Path.Combine(CaptureDir(), $"kit_{roomId}_{stamp}_contract.png");
393+
SetupContractCamera(cam, cols, rows, camFit, 1344f / 768f);
394+
RenderToPng(cam, 1344, 768, contractPath);
390395
}
391396
finally
392397
{
393398
foreach (var rr in hidRends) if (rr != null) rr.enabled = true;
394399
foreach (var ll in disLights) if (ll != null) ll.enabled = true;
395400
}
396-
Debug.Log($"[KitRoom] captured {W}x{H}{outPath}");
401+
Debug.Log($"[KitRoom] captured {W}x{H}{outPath} + contract 1344x768 → {contractPath}");
397402
}
398403

399404
// ════════════════════════════════════════════════════════════════════════════════════════════════
@@ -549,7 +554,9 @@ static GameObject PlacePillar(GameObject prefab, string name, GameObject parent,
549554
Debug.LogWarning($"[KitRoom] ⚠⚠ pillar '{name}' achieved world=({b1.size.x:F2},{b1.size.y:F2},{b1.size.z:F2}) " +
550555
$"is OFF target ({PILLAR_TGT_XZ:F1},{PILLAR_TGT_H:F1},{PILLAR_TGT_XZ:F1}) by >10% — check prefab bounds/pivot.");
551556
Vector3 pivotOffset = inst.transform.position - b1.center;
552-
inst.transform.position = new Vector3(center.x + pivotOffset.x, pivotOffset.y - b1.min.y, center.z + pivotOffset.z);
557+
// r6: ground on min.y alone — the pivotOffset.y term double-counts the bounds centre for
558+
// base-pivot meshes (measured: pillars sat at pos.y=-1.98, bounds -1.99..2.01, half underground).
559+
inst.transform.position = new Vector3(center.x + pivotOffset.x, inst.transform.position.y - b1.min.y, center.z + pivotOffset.z);
553560
FixMaterials(inst, false, ref matFix, force: true); // r5: pillars shipped grey → force stone/brick
554561
return inst;
555562
}

0 commit comments

Comments
 (0)