feat(physics): A6.P1 — add LogPushBackAdjust helper

One-line per-call emission helper for the AdjustSphereToPlane
instrumentation site. Direct field-for-field paired comparison to
retail's CPolygon::adjust_sphere_to_plane breakpoint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-21 18:28:20 +02:00
parent ad6c89de33
commit 3a173b9616

View file

@ -304,6 +304,50 @@ public static class PhysicsDiagnostics
public static bool ProbePushBackEnabled { get; set; } =
Environment.GetEnvironmentVariable("ACDREAM_PROBE_PUSH_BACK") == "1";
/// <summary>
/// A6.P1 emission helper for the <c>AdjustSphereToPlane</c> site.
/// One line per call: input sphere center, plane geometry, push-back
/// delta, walk-interp before/after, and whether the adjust applied.
/// Direct paired comparison to retail's cdb breakpoint on
/// <c>CPolygon::adjust_sphere_to_plane</c>.
///
/// <para>
/// Caller MUST guard with <c>if (!ProbePushBackEnabled) return;</c>
/// before computing the delta arguments — this method assumes the
/// caller paid that price already.
/// </para>
/// </summary>
public static void LogPushBackAdjust(
Vector3 inputCenter,
Vector3 outputCenter,
Plane plane,
float radius,
float walkInterpBefore,
float walkInterpAfter,
float dpPos,
float dpMove,
float iDist,
bool applied)
{
var delta = outputCenter - inputCenter;
float deltaMag = delta.Length();
var ci = System.Globalization.CultureInfo.InvariantCulture;
Console.WriteLine(string.Format(ci,
"[push-back] site=adjust_sphere " +
"in=({0:F4},{1:F4},{2:F4}) " +
"out=({3:F4},{4:F4},{5:F4}) " +
"delta=({6:F4},{7:F4},{8:F4}) deltaMag={9:F4} " +
"n=({10:F4},{11:F4},{12:F4}) d={13:F4} " +
"r={14:F4} winterp={15:F4}->{16:F4} " +
"dpPos={17:F4} dpMove={18:F4} iDist={19:F4} applied={20}",
inputCenter.X, inputCenter.Y, inputCenter.Z,
outputCenter.X, outputCenter.Y, outputCenter.Z,
delta.X, delta.Y, delta.Z, deltaMag,
plane.Normal.X, plane.Normal.Y, plane.Normal.Z, plane.D,
radius, walkInterpBefore, walkInterpAfter,
dpPos, dpMove, iDist, applied));
}
public static void LogCpBoolWrite(string field, bool oldValue, bool newValue)
{
var caller = GetCpCallerName();