MP: world structures (garages/walls) TARGETABLE -- boresight ray-tests the static collision tree (task #50)

The boresight's non-mech pick only sampled the VISUAL heightfield (BTGroundRayHit),
which on arena1 is a single flat 'sky'-named ground mesh (and class-42 BuildTables
likewise holds only 'sky') -- so shots passed THROUGH the garages/walls and only mechs
moved the HUD range axis (user-reported regression: "buildings used to move the range
axis; now only mechs do, and you can only fire at a peer").

Real fix: the boresight now ALSO ray-tests the ZONE'S STATIC COLLISION SOLID TREE --
the same geometry that already blocks the mech's walk. Authentic engine mechanism:
Mover::FindBoxedSolidHitBy already tests the static world via
zone->GetCollisionRoot()->FindBoundingBoxHitBy(line). Factored its "static world" tail
into Mover::FindStaticSolidHitBy(Line*) (static solids only, no movers), wrapped by
Mech::WorldStructurePick(start,dir,range,&hit) (builds the world-space Line, reads the
entry point back via line->FindEnd since HitByBounded clips line->length=enter).

Boresight pick order is now: closest MECH (PickRayHit, damage zones + lock) -> closest
STRUCTURE (WorldStructurePick; occludes a mech BEHIND it; designates the gBTTerrainEntity
sentinel + entry point, so the range caret reads the structure distance and NO lock ring
draws, mech4.cpp:4529) -> flat ground (BTGroundRayHit) -> sky (fire-at-nothing). Also
un-skips arena1's misnamed-'sky' flat ground so the ground tier works (btvisgnd
geometry-aware skip + [mapent]/[rendent] census).

Verified headless: a BT_WSWEEP horizontal ray-fan on arena1 tracks position (3/24 hits
near the boundary -> 17-21/24 inside the interior garage cluster -> 3/24 past it =
DISCRETE interior solids, not an enclosing box), no crash/assert/AV. Interactive aim
(BTGetAimRay) can't run headless (no window -> noRay), so the sweep is the headless proof;
interactive aim is user-verified.

Note: FindBoundingBoxUnder (the ground/containedByNode BoundingBoxTree) is DOWNWARD-only
(gravity/ground-snap: *height = FindDistanceBelowBounded), useless for a horizontal
boresight; the static SOLID tree's FindBoundingBoxHitBy is the only ray-vs-world query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-15 10:08:45 -05:00
co-authored by Claude Opus 4.8
parent ee6e19e86e
commit de8f6d02c1
9 changed files with 222 additions and 4 deletions
+17
View File
@@ -247,6 +247,23 @@ void
else if (gBTTerrainEntity == 0)
gBTTerrainEntity = entity; // else the first world entity
}
// CENSUS: what world-geometry entities does the RENDER tree walk?
// (the garages/structures may be here even if not in the map's class-42
// instance stream that BuildTables reads.)
if (getenv("BT_GROUND_LOG"))
{
Derivation *dv = entity->GetClassDerivations();
const int isTer = entity->IsDerivedFrom(*Terrain::GetClassDerivations())?1:0;
const Point3D &ep = entity->localOrigin.linearPosition;
// tag NON-terrain entities distinctly -- these are the structures
// (garages/walls/props); log their world XZ so we can spawn beside
// one and confirm it is a collision solid the boresight now hits.
DEBUG_STREAM << (isTer ? "[rendent]" : "[rendent-STRUCT]")
<< " class='" << (dv && dv->className ? dv->className : "?")
<< "' terrain=" << isTer
<< " pos=(" << ep.x << "," << ep.y << "," << ep.z << ")"
<< "\n" << std::flush;
}
}
DPLRenderer::MakeEntityRenderables(
entity, model_resource, view_type);