Fix Ogre2 CPU ray queries from inside AABBs - #1324
Open
Dylan-Gallagher wants to merge 1 commit into
Open
Conversation
Keep zero-distance broadphase candidates because Ogre reports zero when the ray origin lies inside an object AABB. The triangle-level pass can still find a valid front-face intersection. Add a rotated-box regression whose AABB contains the ray origin while the geometry does not. Generated-by: OpenAI Codex (GPT-5; accessed 2026-08-18) Signed-off-by: Dylan Gallagher <76841713+Dylan-Gallagher@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🦟 Bug fix
Fixes #1226.
Summary
Ogre returns a broadphase distance of zero when a ray starts inside an object's axis-aligned bounding box. The Ogre2 CPU ray-query path discarded all candidates with a distance less than or equal to zero, so it never ran the triangle-level intersection pass for those objects.
This change keeps zero-distance candidates while continuing to reject negative distances. The narrowphase still determines whether the ray actually intersects the geometry.
The regression test uses a rotated box whose AABB contains the ray origin while the box geometry does not. Before the fix, the CPU ray query reports no result. After the fix, it returns the expected front-face intersection, object ID, distance, and point.
Backport Policy
Validation
codecheck: cpplint and cppcheck targets passed.<= 0.0makesRayQueryTest.RayOriginInsideObjectBoundsfail because the result is empty.Checklist
codecheckpassed (See contributing)Generated-by: OpenAI Codex (GPT-5; accessed 2026-08-18)
Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.