refactor(physics): promote ACDREAM_DUMP_STEEP_ROOF into PhysicsDiagnostics
First application of CLAUDE.md's new Code Structure Rules §5
("Runtime probes belong in diagnostic owner classes"). Migrates the
four ACDREAM_DUMP_STEEP_ROOF call-site env reads into a single
PhysicsDiagnostics.DumpSteepRoofEnabled property initialized from the
env var at type init, with a runtime setter that follows the existing
ProbeResolveEnabled / ProbeCellEnabled / ProbeBuildingEnabled pattern.
Sites migrated:
- AcDream.Core/Physics/PhysicsEngine.cs:637 (KILL-VELOCITY-APPLIED log)
- AcDream.Core/Physics/TransitionTypes.cs:718 (PHASE3-RESET log)
- AcDream.App/Input/PlayerMovementController.cs:1117 (FRAME log)
- AcDream.App/Input/PlayerMovementController.cs:1199 (per-frame bounce log)
Behavior-preservation only. ACDREAM_DUMP_STEEP_ROOF=1 still produces
identical [steep-roof] log output. The class-comment in
PhysicsDiagnostics already anticipated this migration
("Future slices may fold the older ACDREAM_DUMP_* env vars into this
class for unified runtime toggling").
Not yet wired to a DebugVM checkbox — runtime toggling is available
via the property setter for future debugging sessions, but exposing
it on the panel is a 30-second future cut, not in scope here.
Build: green.
Tests: same pass/fail profile as before this commit (8 pre-existing
Core failures unrelated to physics-diagnostics; App.Tests / Core.Net.Tests
/ UI.Abstractions.Tests all green).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
eda936dc4d
commit
32423c2ba2
4 changed files with 29 additions and 4 deletions
|
|
@ -1114,7 +1114,7 @@ public sealed class PlayerMovementController
|
||||||
// L.4-diag (2026-04-30): trace position transitions so we can see
|
// L.4-diag (2026-04-30): trace position transitions so we can see
|
||||||
// whether the body is actually moving frame-to-frame on the steep
|
// whether the body is actually moving frame-to-frame on the steep
|
||||||
// roof, or whether it's frozen at the impact point.
|
// roof, or whether it's frozen at the impact point.
|
||||||
if (Environment.GetEnvironmentVariable("ACDREAM_DUMP_STEEP_ROOF") == "1"
|
if (AcDream.Core.Physics.PhysicsDiagnostics.DumpSteepRoofEnabled
|
||||||
&& resolveResult.CollisionNormalValid)
|
&& resolveResult.CollisionNormalValid)
|
||||||
{
|
{
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
|
|
@ -1196,7 +1196,7 @@ public sealed class PlayerMovementController
|
||||||
: (!prevOnWalkable && !nowOnWalkable);
|
: (!prevOnWalkable && !nowOnWalkable);
|
||||||
|
|
||||||
// L.4-diag (2026-04-30): per-frame bounce trace for steep-roof bug.
|
// L.4-diag (2026-04-30): per-frame bounce trace for steep-roof bug.
|
||||||
bool diagSteep = Environment.GetEnvironmentVariable("ACDREAM_DUMP_STEEP_ROOF") == "1";
|
bool diagSteep = AcDream.Core.Physics.PhysicsDiagnostics.DumpSteepRoofEnabled;
|
||||||
if (diagSteep && resolveResult.CollisionNormalValid)
|
if (diagSteep && resolveResult.CollisionNormalValid)
|
||||||
{
|
{
|
||||||
var n0 = resolveResult.CollisionNormal;
|
var n0 = resolveResult.CollisionNormal;
|
||||||
|
|
|
||||||
|
|
@ -141,4 +141,29 @@ public static class PhysicsDiagnostics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool ProbeUseabilityFallbackEnabled { get; set; } =
|
public static bool ProbeUseabilityFallbackEnabled { get; set; } =
|
||||||
Environment.GetEnvironmentVariable("ACDREAM_PROBE_USEABILITY_FALLBACK") == "1";
|
Environment.GetEnvironmentVariable("ACDREAM_PROBE_USEABILITY_FALLBACK") == "1";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// L.4-diag (2026-04-30) → promoted into <see cref="PhysicsDiagnostics"/>
|
||||||
|
/// 2026-05-16 per CLAUDE.md "Code Structure Rules" §5 (diagnostic owner
|
||||||
|
/// classes, not per-call-site env reads). Gates the <c>[steep-roof]</c>
|
||||||
|
/// trace family that fires from four sites during the rooftop-bounce
|
||||||
|
/// investigation:
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item><description><c>PhysicsEngine.ResolveWithTransition</c> —
|
||||||
|
/// <c>[steep-roof] KILL-VELOCITY-APPLIED</c> when retail-faithful
|
||||||
|
/// <c>kill_velocity</c> zeroes the body's velocity on steep-slope
|
||||||
|
/// impact.</description></item>
|
||||||
|
/// <item><description><c>TransitionTypes</c> (<c>FindEnvCollisions</c>
|
||||||
|
/// post-step) — per-frame plane-normal trace on the active
|
||||||
|
/// <see cref="CollisionInfo"/>.</description></item>
|
||||||
|
/// <item><description><c>PlayerMovementController</c> — two sites
|
||||||
|
/// emitting <c>[steep-roof]</c> + the per-frame bounce trace when
|
||||||
|
/// the post-collision velocity disagrees with retail.</description></item>
|
||||||
|
/// </list>
|
||||||
|
/// Initial state from <c>ACDREAM_DUMP_STEEP_ROOF=1</c>. Runtime-toggleable
|
||||||
|
/// via the property setter; not yet wired to a DebugPanel checkbox (open
|
||||||
|
/// follow-up if a debugging session calls for it).
|
||||||
|
/// </summary>
|
||||||
|
public static bool DumpSteepRoofEnabled { get; set; } =
|
||||||
|
Environment.GetEnvironmentVariable("ACDREAM_DUMP_STEEP_ROOF") == "1";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -634,7 +634,7 @@ public sealed class PhysicsEngine
|
||||||
// acclient_2013_pseudo_c.txt:272567 (validate_transition)
|
// acclient_2013_pseudo_c.txt:272567 (validate_transition)
|
||||||
if (transition.ObjectInfo.VelocityKilled)
|
if (transition.ObjectInfo.VelocityKilled)
|
||||||
{
|
{
|
||||||
if (Environment.GetEnvironmentVariable("ACDREAM_DUMP_STEEP_ROOF") == "1")
|
if (PhysicsDiagnostics.DumpSteepRoofEnabled)
|
||||||
Console.WriteLine($"[steep-roof] KILL-VELOCITY-APPLIED Vbefore=({body.Velocity.X:F2},{body.Velocity.Y:F2},{body.Velocity.Z:F2}) → 0,0,0");
|
Console.WriteLine($"[steep-roof] KILL-VELOCITY-APPLIED Vbefore=({body.Velocity.X:F2},{body.Velocity.Y:F2},{body.Velocity.Z:F2}) → 0,0,0");
|
||||||
body.Velocity = Vector3.Zero;
|
body.Velocity = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -715,7 +715,7 @@ public sealed class Transition
|
||||||
ci.ContactPlaneValid = false;
|
ci.ContactPlaneValid = false;
|
||||||
ci.ContactPlaneIsWater = false;
|
ci.ContactPlaneIsWater = false;
|
||||||
|
|
||||||
bool diagSteep = Environment.GetEnvironmentVariable("ACDREAM_DUMP_STEEP_ROOF") == "1";
|
bool diagSteep = PhysicsDiagnostics.DumpSteepRoofEnabled;
|
||||||
if (diagSteep)
|
if (diagSteep)
|
||||||
{
|
{
|
||||||
Console.WriteLine(
|
Console.WriteLine(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue