acdream/tests/AcDream.Core.Tests/Physics
Erik d2f6067960 fix(physics): L.2.3c — preserve contact plane through failed step-up
The "stuck in falling animation against walls" live-test bug (intermittent,
hard to recover from). Two compounding issues, fixed at both layers.

(1) DoStepUp cleared CollisionInfo.ContactPlaneValid unconditionally at
    the start of step-up. On step-up FAILURE, RestoreCheckPos restored
    the position but the contact plane stayed cleared. Added a save/
    restore around the clear so a failed step-up returns the mover to
    its pre-attempt grounded state.

(2) ValidateTransition propagated the current frame's invalid contact
    state into LastKnownContactPlane via:
        ci.LastKnownContactPlaneValid = ci.ContactPlaneValid
    This destroyed the prior frame's ground memory whenever the current
    contact was momentarily lost (StepUpSlide clears ContactPlane).
    Changed to: only OVERWRITE LastKnown when current is valid.

(3) The same ValidateTransition then set
        oi.State &= ~(Contact | OnWalkable)
    when ContactPlaneValid was false, even if LastKnown was still
    valid. Added an "else if (LastKnownContactPlaneValid)" branch that
    sets Contact + OnWalkable from LastKnown so the animation system
    sees the mover as grounded.

Combined effect: walking into a too-tall wall now consistently slides
along the wall without ever flickering to the falling animation. The
mover's grounded state survives transient ContactPlane invalidation
during the step-up retry cycle.

Retail's `transitional_insert` has different upstream invariants that
keep ContactPlane valid more often, so retail doesn't need the
acdream-specific LastKnown fallback path. ACE has the same pattern as
retail; acdream's per-frame Resolve architecture exposes the gap that
this fix closes.

Tests:
- New D1 regression test: grounded mover into too-tall wall — must
  end frame with grounded state preserved.
- New D2 regression test: same scenario — execution time bounded
  (<100ms) to catch any future recursion issues.

Files:
- TransitionTypes.cs DoStepUp: save+restore ContactPlane around step-up
- TransitionTypes.cs ValidateTransition: preserve LastKnown + grounded
  state from last-known when current is invalid
- BSPStepUpTests.cs: D1, D2 regression tests

Test count 825 → 825 (D1+D2 added in L.2.3 patch series). Build clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 17:24:49 +02:00
..
AnimationCommandRouterTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
AnimationHookRouterTests.cs feat(anim): Phase E.1 hook router + GameWindow wiring 2026-04-18 16:30:23 +02:00
AnimationSequencerTests.cs fix(anim): Phase L.1c sequencer cycle fallback for missing MoveTo motion 2026-04-29 10:33:48 +02:00
BSPQueryTests.cs feat(physics): PhysicsDataCache + BSP sphere query 2026-04-13 23:28:39 +02:00
BSPStepUpFixtures.cs feat(physics): Phase L.2.1+L.2.2 — BSP step-up and rooftop landing 2026-04-29 16:16:39 +02:00
BSPStepUpTests.cs fix(physics): L.2.3c — preserve contact plane through failed step-up 2026-04-29 17:24:49 +02:00
CellSurfaceTests.cs feat(core): Phase B.3 — CellSurface (indoor floor polygon projection) 2026-04-12 09:51:22 +02:00
CollisionExemptionTests.cs feat(physics): retail PvP exemption + viewer/creature/missile gates (Commit C) 2026-04-29 13:21:36 +02:00
CollisionPrimitivesTests.cs feat(physics): port 9 collision primitives from acclient.exe (chunk_00530000.c) 2026-04-12 23:53:47 +02:00
EntityCollisionFlagsTests.cs feat(physics): live-entity collision plumbing (Commit A) 2026-04-29 13:12:56 +02:00
MotionCommandResolverTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
MotionInterpreterTests.cs fix(anim): Phase L.1b route motion commands 2026-04-28 10:46:22 +02:00
PhysicsBodyTests.cs feat(core): port decompiled AC client physics — CollisionPrimitives + PhysicsBody 2026-04-12 23:54:51 +02:00
PhysicsEngineTests.cs feat(core): Phase B.3 — CellPortal-based indoor/outdoor transitions in PhysicsEngine 2026-04-12 18:22:55 +02:00
PlayerWeenieTests.cs feat(physics): PlayerWeenie with retail Run/Jump formulas 2026-04-13 23:15:25 +02:00
PortalPlaneTests.cs feat(core): Phase B.3 — PortalPlane (plane math + crossing detection) 2026-04-12 18:17:48 +02:00
RemoteMoveToDriverTests.cs fix(anim): Phase L.1c clamp approach velocity to prevent overshoot 2026-04-29 10:14:35 +02:00
ServerControlledLocomotionTests.cs fix(anim): Phase L.1c match MoveTo run speed 2026-04-28 20:58:22 +02:00
ShadowObjectRegistryTests.cs feat(physics): live-entity collision plumbing (Commit A) 2026-04-29 13:12:56 +02:00
TerrainSurfaceTests.cs feat(core): Phase B.3 — TerrainSurface (outdoor heightmap Z + cell ID) 2026-04-12 09:51:54 +02:00
TransitionTests.cs feat(physics): Transition.FindTransitionalPosition core algorithm 2026-04-13 23:52:45 +02:00