Skip to content

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

Open
untoldengine wants to merge 1 commit into
developfrom
fix/physics_raycast_octree_maxdistance
Open

Fix octree raycast fallback dropping inside-origin hits under tight maxDistance#1155
untoldengine wants to merge 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.
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