Skip to content

Fix octree raycast fallback dropping inside-origin hits under tight maxDistance - #1155

Merged
untoldengine merged 1 commit into
developfrom
fix/physics_raycast_octree_maxdistance
Aug 27, 2026
Merged

Fix octree raycast fallback dropping inside-origin hits under tight maxDistance#1155
untoldengine merged 1 commit into
developfrom
fix/physics_raycast_octree_maxdistance

Conversation

@untoldengine

Copy link
Copy Markdown
Owner

No description provided.

… tight maxDistance

OctreeSystem.query's own maxDistance cull compares against its sorted
  ray-AABB distance, which for an inside-origin box is the far EXIT
  distance, not the true hit distance. A short raycast whose origin sits
  inside a large registered AABB would get that box dropped before
  PhysicsQuery's narrow phase ever recomputed the correct entry distance
  (0, per the documented inside-the-box contract) — reporting a miss
  instead of the real hit.

  The query is now asked for the unbounded fallback distance instead of
  the caller's maxDistance; the narrow phase already enforces the real
  cap correctly, against the recomputed entry distance. For outside-origin
  candidates (where the broad-phase distance already equals the true hit
  distance) this changes nothing but which phase does the filtering.

  Adds a regression test with a tight maxDistance smaller than the
  containing box's exit distance; verified it fails against the previous
  code and passes now.
@untoldengine
untoldengine merged commit bb6ee36 into develop Aug 27, 2026
4 checks passed
@untoldengine
untoldengine deleted the fix/physics_raycast_octree_maxdistance branch August 27, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant