fix #116 (partial, Ghidra-confirmed): slide_sphere degenerate guard uses F_EPSILON, not EpsilonSq
The user brought up Ghidra; its decompiler (patchmem.gpr, full PDB)
resolved the Binary-Ninja `test ah,5` x87 branch-sign ambiguity that
blocked the desk read. CSphere::slide_sphere (0x00537440) decompiles
cleanly to:
fVar3 = |cross(collisionNormal, contactPlane.N)|²;
if (::F_EPSILON <= fVar3) { // crease exists
... offset = cross * dot(cross,gDelta)/fVar3;
if (|offset|² < ::F_EPSILON) return COLLIDED_TS; // degenerate guard
... add_offset_to_check_pos -> SLID_TS
}
Retail compares the SQUARED magnitudes against F_EPSILON
(0.000199999995 ~= 0.0002 = PhysicsGlobals.EPSILON). Our port compared
against EpsilonSq (0.0002^2 = 4e-8) - a ~5000x too-tight threshold (the
BN pseudo-C rendered the comparison as `test ah,5` after an x87 FCMP,
which is sign-ambiguous; agent reads disagreed). Fixed both comparisons
at TransitionTypes.cs:3098,3105 to EPSILON.
Effect: crease-exists now needs >=0.81 deg between the wall and contact
normals (was 0.011 deg - which routed near-parallel pairs through the
numerically unstable projection); the degenerate guard now hard-stops
slides under ~1.41 cm like retail (was 0.2 mm). Branch POLARITY was
already correct - no change there.
No regression: full physics suite (612) + full Core (1443) green. Not a
register deviation (no row existed; this is an undocumented porting
error corrected to match retail).
This does NOT close #116 - it fixes a tangential constant, not either
reported shape. Ghidra also settled the two shapes' diagnosis (recorded
in ISSUES.md #116 + physics digest):
- Shape-1: our cn=UnitZ default IS retail-faithful (validate_transition
0x0050aa70 has the identical `if (collision_normal_valid==0)
set_collision_normal(UnitZ)`). The real divergence is upstream -
tick-22760 our collision_normal_valid was false where retail's was
true (it recorded the door-face normal). Needs the instrumented
tick-22760 replay.
- Shape-2 (D4 stays skipped, note sharpened): slide_sphere slides
in-frame (SLID_TS) so Z=1.92 is faithful and the D4 Z=2.0 hard-stop
pin is the suspect half; the threshold fix didn't move D4 (real slide,
not degenerate). Needs a cdb trace of an airborne wall hit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
35961f2039
commit
bf18a54369
3 changed files with 60 additions and 11 deletions
|
|
@ -3930,13 +3930,47 @@ retail's viewer-distance smoothing (update_viewer region) before touching.
|
|||
|
||||
## #116 — Slide-response divergence family: near-perpendicular lateral slide lost + first-airborne-frame in-frame slide vs hard stop
|
||||
|
||||
**Status:** OPEN
|
||||
**Status:** OPEN (narrowed) — one Ghidra-confirmed faithfulness fix
|
||||
SHIPPED 2026-06-12; both reported shapes still need a runtime trace.
|
||||
**Severity:** LOW-MEDIUM (over-blocking, never under-blocking — no
|
||||
walk-throughs; feel-level divergence at walls/doors)
|
||||
**Filed:** 2026-06-11 (BR-7 / A6.P4 ship session)
|
||||
**Component:** physics (slide response — `SlideSphere` degenerate-offset
|
||||
guard + first-contact-frame behavior)
|
||||
|
||||
**GHIDRA SESSION 2026-06-12 (the BN branch-sign ambiguity RESOLVED via a
|
||||
second decompiler — Ghidra MCP, patchmem.gpr, full PDB):**
|
||||
- **SHIPPED (faithfulness fix):** `CSphere::slide_sphere` (Ghidra
|
||||
`0x00537440`) compares its SQUARED magnitudes against `::F_EPSILON`
|
||||
(= 0.000199999995 ≈ 0.0002 = `PhysicsGlobals.EPSILON`): `if (::F_EPSILON
|
||||
<= |cross|²)` (crease) and `if (|offset|² < ::F_EPSILON) return
|
||||
COLLIDED_TS` (degenerate guard). Our port compared against `EpsilonSq`
|
||||
(0.0002² = 4e-8) — a ~5000× too-tight threshold (the BN `test ah,5`
|
||||
obscured it). Fixed at `TransitionTypes.cs:3098,3105`; full physics
|
||||
suite (612) + full Core (1443) green, no regression. Crease now needs
|
||||
≥0.81° between normals (was 0.011°); the guard stops slides under
|
||||
~1.41 cm like retail (was 0.2 mm). NOT a register deviation (no row
|
||||
existed — it was an undocumented porting error; the fix matches retail).
|
||||
⚠️ This does NOT fix either reported shape below.
|
||||
- **Shape-1 RE-DIAGNOSED — our `cn=UnitZ` default is RETAIL-FAITHFUL.**
|
||||
Ghidra `validate_transition` (`0x0050aa70`) does exactly our
|
||||
`TransitionTypes.cs:3701-3702`: `if (collision_normal_valid == 0)
|
||||
set_collision_normal(UnitZ)`. So the harness `cn=(0,0,1)` is the
|
||||
faithful FALLBACK; the real divergence is UPSTREAM — at tick-22760 our
|
||||
`collision_normal_valid` was FALSE (→ UnitZ) where retail's was TRUE
|
||||
(it had recorded the door-face normal `(0,+1,0)`). The bug is in the
|
||||
COLLISION-RECORDING path (find_collisions / collide_with_environment),
|
||||
not slide/validate. Next: replay tick-22760
|
||||
(`DoorBugTrajectoryReplayTests`) instrumented to see where our
|
||||
collision-normal recording drops the wall normal.
|
||||
- **Shape-2 NARROWED — D4 stays skipped.** Ghidra confirms slide_sphere
|
||||
applies the slide IN-FRAME (`add_offset_to_check_pos` → SLID_TS), so our
|
||||
Z=1.92 is faithful TO slide_sphere and the D4 Z=2.0 hard-stop pin is the
|
||||
SUSPECT half. But the threshold fix did NOT change D4 (its offset is a
|
||||
real slide, not degenerate), so whether retail's first airborne frame
|
||||
REACHES slide_sphere (→1.92) or hard-stops upstream still needs a cdb
|
||||
trace of an airborne wall hit before flipping the assertion.
|
||||
|
||||
**Two pinned shapes, both pre-dating BR-7 (the per-cell shadow port left
|
||||
them byte-identical):**
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue