Fair on all four. Conceded, and here is what your setup introduces instead.
isVisible - yes, I aimed at the field a reader would reach for, not at what you had. Colliders - half right and worth one line:
Physics.Raycast is not callable externally, but
bounds,
isTrigger and
layer are readable off the managed object, so the filters are not dead, just irrelevant while the snapshot is geometry-only. 0.85 shrink - agreed, that is an AABB compensation and it is wrong for exact OBBs. ABI - agreed, x86_64 to x86_64.
1. First thing to check: are you comparing t at all
A ray that hits a box behind the target still reports blocked. If the test is "first hit exists", everything with geometry behind it reads red, and the further out the target the worse it gets - your 82m entries would be permanently red through open sky if a hill is 200m back. The comparison is:
Code:
blocked = (t_hit < t_target - 0.05f);
Measure
t_target to the
same sample point you are testing, not to the root, or chest and root disagree and you get a systematic offset at range.
2. Ray origin inside a box
Pressed against a wall or scoped flush to cover, the camera origin sits inside geometry and a slab test returns t=0. Depending on how you branch that, you get either permanent red or green through the wall.
Treat "origin inside box" as non-blocking and start the ray at the near plane - being inside a wall does mean you can see out of it.
3. Snapshot coherence
This is the one that will bite in a build game. Players build walls.
A timer-rebuilt snapshot has a window where a fresh wall does not exist and you read green straight through it. Rebuild on spawn/despawn deltas rather than on a clock, and swap buffers - never mutate the live one.
If the rebuild is on a worker and the test is on the render thread, double-buffer with an atomic generation counter and publish only after the swap, or you iterate a half-updated set and ray against boxes that moved out from under you.
4. Broadphase, because OBB is not AABB
Slab against an OBB means transforming the ray into box space first, so it is roughly double an AABB test, and your snapshot is dense. At 82m, sorting by t and breaking early still means touching every box closer than the target.
Bucket the snapshot into a grid and walk cells along the ray - you only ever test what the ray actually crosses. Cheap to add, and it is the difference between holding frame rate at 8 targets and 30.
5. Hysteresis: freeze, do not decay
2/4 is the right asymmetry. Add one rule though -
when a target stops being sampled, off-screen or past the cap, hold its last state instead of letting it tick toward red. Otherwise the counter runs down while it is out of view and it pops green on re-entry from a read that is seconds stale.
6. When you do test enabled
Right call deferring it. When you get there: the model root carries several renderers - skin, weapon, attachments, nameplate - and
enabled on the skinned mesh also flips for attachment swap and LOD, not only occlusion. Use it as a cross-check against the OBB result, never as the driver, or you will chase desyncs that are not occlusion at all.
TL;DR -
t_hit < t_target or nothing behind the target matters. Origin-inside means not blocked. Rebuild on deltas, double-buffer, publish after swap. Grid broadphase. Freeze hysteresis when unsampled.
enabled is a cross-check only.