Boresight parallax FIXED + the #4/#5 verdict instrumentation (Gitea #16, #4, #5)

PARALLAX (#16): the pick/fire ray was anchored at mech.y+5.0 (a port
improvisation) while the sight line ran from the eyepoint (y=6.23) --
two parallel rays whose constant offset grew into the reported low-miss
as range closed (measured ry +0.072 @50u -> +1.54 @2.7u).  The decomp's
sight and pick share the eye origin (HudSimulation @4b7830 chain).  Fix:
the viewpoint mech's cockpit eye owns the aim-camera publish in BOTH
views, origin = its own eye translation; leveling + deliberate elevation
untouched; chase view now converges to cockpit ballistics (V cannot
change where shots land).  After: pick pinned to the crosshair (ry <=
5e-6) from 50u to point-blank; 26 laser + 8 missile center-mass hits at
3/4-screen.  Awaiting the reporters' approach-test.

VERDICT INSTRUMENTATION (#4 closed authentic, #5 verdict posted):
BT_RANGE_LOG per-frame pick tracing + BTGroundRayHitExact analytic
cross-check (0/8000 arena fall-throughs; cavern 6/8400 single-frame
grazes -- the 'crazy sliding' is the authentic world-pick + 500 m/s
slide over depth discontinuities); BT_AUD_TAIL StopNote/fade timing +
BT_FIRE_PULSE single-shot driver (the energy 'buzz' is the AUTHORED
charging loop: crescendo through recharge, 1.309s authored release,
measured within one frame).  CAVERN.EGG: solo cavern test egg.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-20 14:51:54 -05:00
co-authored by Claude Fable 5
parent d7158f1f82
commit 70eea6c1a4
13 changed files with 744 additions and 18 deletions
+69
View File
@@ -329,3 +329,72 @@ bool
}
return false;
}
//---------------------------------------------------------------------------//
// BTGroundRayHitExact -- BT_RANGE_LOG diagnostic (Gitea #4 verdict
// instrumentation, uncommitted): ANALYTIC closest-hit ray intersect
// (Moller-Trumbore, no backface cull, no step size, no height band) over the
// SAME visual triangle set the march samples -- including vertical walls and
// ceilings, which SampleBand's XZ point-in-triangle test cannot see. The
// march-vs-exact range difference on the same ray is direct evidence for (or
// against) the "ray falls through geometry" hypothesis; it is NOT used by any
// gameplay path.
//---------------------------------------------------------------------------//
bool
BTGroundRayHitExact(float ox, float oy, float oz,
float dx, float dy, float dz,
float maxDist, float *hx, float *hy, float *hz)
{
if (gState == 0)
gState = BuildTables() ? 1 : -1;
if (gState != 1)
return false;
float bestT = maxDist;
bool found = false;
for (size_t ii = 0; ii < gInsts.size(); ++ii)
{
const VgInst &inst = gInsts[ii];
// local-space ray (instances are translation-placed only)
const float lox = ox - inst.px, loy = oy - inst.py, loz = oz - inst.pz;
const VgMesh &m = gMeshes[inst.mesh];
for (size_t ti = 0; ti < m.tris.size(); ++ti)
{
const VgTri &t = m.tris[ti];
const float e1x = t.bx - t.ax, e1y = t.by - t.ay, e1z = t.bz - t.az;
const float e2x = t.cx - t.ax, e2y = t.cy - t.ay, e2z = t.cz - t.az;
// p = dir x e2
const float px = dy * e2z - dz * e2y;
const float py = dz * e2x - dx * e2z;
const float pz = dx * e2y - dy * e2x;
const float det = e1x * px + e1y * py + e1z * pz;
if (det > -1e-9f && det < 1e-9f)
continue; // parallel
const float inv = 1.0f / det;
const float tx = lox - t.ax, ty = loy - t.ay, tz = loz - t.az;
const float u = (tx * px + ty * py + tz * pz) * inv;
if (u < 0.0f || u > 1.0f)
continue;
// q = tvec x e1
const float qx = ty * e1z - tz * e1y;
const float qy = tz * e1x - tx * e1z;
const float qz = tx * e1y - ty * e1x;
const float v = (dx * qx + dy * qy + dz * qz) * inv;
if (v < 0.0f || u + v > 1.0f)
continue;
const float tt = (e2x * qx + e2y * qy + e2z * qz) * inv;
if (tt > 0.05f && tt < bestT)
{
bestT = tt;
found = true;
}
}
}
if (found)
{
*hx = ox + dx * bestT;
*hy = oy + dy * bestT;
*hz = oz + dz * bestT;
}
return found;
}