diag(phys): A6.P3 slice 4 — add [poly-dump] probe for #98 investigation

Adds a polygon-geometry dump probe that fires alongside [push-back]
whenever AdjustSphereToPlane lands a push-back. Gated by
ACDREAM_PROBE_POLY_DUMP=1.

Output format:
  [poly-dump] cell=0xA9B40147 polyId=0x0042 numPts=4 sides=Single
              n=(0.000,-0.719,0.695) d=-0.1007
              verts=[(x1,y1,z1),(x2,y2,z2),(x3,y3,z3),(x4,y4,z4)]

Purpose: investigate #98 (cellar-up stuck at top step). The push-back
trace shows the player hitting a sloped surface n=(0,-0.719,0.695) at
the cellar stair top. Two possibilities:
  1. The polygon really IS sloped 44° in the dat (genuine geometry).
  2. Our dat-read produces wrong vertices → wrong normal → wrong plane.

The dump lets us:
- Identify which dat polygon was hit (cell + poly ID)
- Compare our extracted vertices against WorldBuilder's straight-from-
  dat read for the same poly
- Or spawn the cell in ACViewer to visually verify the geometry

Changes:
- Added `ushort Id` property to ResolvedPolygon (defaults to 0 for test
  fixtures that don't care; production code in PhysicsDataCache.cs +
  BSPQuery.cs sets it from the dictionary key).
- Added ProbePolyDumpEnabled + LogPolyDump in PhysicsDiagnostics.
- Wired the dump into AdjustSphereToPlane's apply-branch (after the
  existing push-back log; same gating pattern).

Test suite: 1148 pass + 8 pre-existing fail (baseline maintained).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-22 12:17:47 +02:00
parent ceeb06be7d
commit 0b449968a7
3 changed files with 64 additions and 0 deletions

View file

@ -289,6 +289,7 @@ public sealed class PhysicsDataCache
Plane = new Plane(normal, d),
NumPoints = numVerts,
SidesType = poly.SidesType,
Id = id,
};
}
return resolved;
@ -383,6 +384,15 @@ public sealed class ResolvedPolygon
public required Plane Plane { get; init; }
public required int NumPoints { get; init; }
public required CullMode SidesType { get; init; }
/// <summary>
/// Polygon index within its parent (cell or GfxObj). Used by the
/// `ACDREAM_PROBE_POLY_DUMP` probe (A6.P3 slice 4 investigation,
/// 2026-05-22) to identify which dat polygon a push-back hit so we
/// can compare our extracted vertices/plane against WorldBuilder's
/// straight-from-dat read. Defaults to 0 for test fixtures that
/// don't care about polygon identity.
/// </summary>
public ushort Id { get; init; }
}
/// <summary>Cached physics data for a single GfxObj part.</summary>