feat(physics): ProbeWalkMissEnabled flag for ISSUES #83 H-disambiguation
Adds a new diagnostic flag for the indoor-walking walk-miss probe spike per docs/superpowers/specs/2026-05-21-indoor-walk-miss-probe-design.md. Env var ACDREAM_PROBE_WALK_MISS=1, runtime-toggleable via property. No DebugPanel mirror — spike-only. Following commits wire the [walk-miss] and [floor-polys] emissions to this flag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d258334573
commit
27c728484d
2 changed files with 74 additions and 0 deletions
|
|
@ -243,6 +243,39 @@ public static class PhysicsDiagnostics
|
|||
public static bool ProbeContactPlaneEnabled { get; set; } =
|
||||
Environment.GetEnvironmentVariable("ACDREAM_PROBE_CONTACT_PLANE") == "1";
|
||||
|
||||
/// <summary>
|
||||
/// Indoor walking ISSUES #83 H-disambiguation spike (2026-05-21).
|
||||
/// When true, two diagnostic emissions activate:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>One <c>[walk-miss]</c> line per
|
||||
/// <see cref="Transition.TryFindIndoorWalkablePlane"/> MISS
|
||||
/// event, dumping foot world/local position, the nearest
|
||||
/// walkable polygon in the cell (with XY-containment flag and
|
||||
/// vertical gap), and whether the LandCell terrain at the same
|
||||
/// XY would have grounded the player.</description></item>
|
||||
/// <item><description>One <c>[floor-polys]</c> line per indoor
|
||||
/// cell cached, enumerating each walkable-eligible polygon's
|
||||
/// id, normal Z, local-XY bounding box, and plane Z at the
|
||||
/// bbox center.</description></item>
|
||||
/// </list>
|
||||
/// Together these answer H1 (multi-cell iteration missing) vs H2
|
||||
/// (probe distance too short) vs H3 (poly absent /
|
||||
/// <c>walkable_hits_sphere</c> rejection) for the ISSUES #83
|
||||
/// stuck-falling bug. Spike-only — remove once the root cause is
|
||||
/// identified and the fix lands.
|
||||
///
|
||||
/// <para>
|
||||
/// Initial state from <c>ACDREAM_PROBE_WALK_MISS=1</c>.
|
||||
/// No DebugPanel mirror — one-shot diagnostic.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// Spec: <c>docs/superpowers/specs/2026-05-21-indoor-walk-miss-probe-design.md</c>.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static bool ProbeWalkMissEnabled { get; set; } =
|
||||
Environment.GetEnvironmentVariable("ACDREAM_PROBE_WALK_MISS") == "1";
|
||||
|
||||
public static void LogCpBoolWrite(string field, bool oldValue, bool newValue)
|
||||
{
|
||||
var caller = GetCpCallerName();
|
||||
|
|
|
|||
41
tests/AcDream.Core.Tests/Physics/WalkMissDiagnosticTests.cs
Normal file
41
tests/AcDream.Core.Tests/Physics/WalkMissDiagnosticTests.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using AcDream.Core.Physics;
|
||||
using DatReaderWriter.Enums;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.Core.Tests.Physics;
|
||||
|
||||
/// <summary>
|
||||
/// Tests for the ISSUES #83 H-disambiguation probe spike (spec
|
||||
/// 2026-05-21-indoor-walk-miss-probe-design.md).
|
||||
///
|
||||
/// Covers:
|
||||
/// 1. PhysicsDiagnostics.ProbeWalkMissEnabled flag get/set roundtrip.
|
||||
/// 2. WalkMissDiagnostic.AggregateNearestWalkable selects the nearest
|
||||
/// walkable polygon by |dz| when the foot XY lies inside a poly's
|
||||
/// local XY bounding box.
|
||||
/// 3. WalkMissDiagnostic.AggregateNearestWalkable falls back to the
|
||||
/// nearest poly by |dz| when no walkable poly XY-contains the foot,
|
||||
/// reporting ContainsFootXY=false.
|
||||
/// </summary>
|
||||
public class WalkMissDiagnosticTests
|
||||
{
|
||||
[Fact]
|
||||
public void ProbeWalkMiss_StaticApi_Roundtrip()
|
||||
{
|
||||
bool initial = PhysicsDiagnostics.ProbeWalkMissEnabled;
|
||||
try
|
||||
{
|
||||
PhysicsDiagnostics.ProbeWalkMissEnabled = true;
|
||||
Assert.True(PhysicsDiagnostics.ProbeWalkMissEnabled);
|
||||
|
||||
PhysicsDiagnostics.ProbeWalkMissEnabled = false;
|
||||
Assert.False(PhysicsDiagnostics.ProbeWalkMissEnabled);
|
||||
}
|
||||
finally
|
||||
{
|
||||
PhysicsDiagnostics.ProbeWalkMissEnabled = initial;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue