Skip to content

Fix Ogre2 CPU ray queries from inside AABBs - #1324

Open
Dylan-Gallagher wants to merge 1 commit into
gazebosim:mainfrom
Dylan-Gallagher:fix/1226-ray-origin-aabb
Open

Fix Ogre2 CPU ray queries from inside AABBs#1324
Dylan-Gallagher wants to merge 1 commit into
gazebosim:mainfrom
Dylan-Gallagher:fix/1226-ray-origin-aabb

Conversation

@Dylan-Gallagher

Copy link
Copy Markdown

🦟 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

  • This is safe to backport to the following versions:
    • Jetty
    • Ionic
    • Harmonic
    • Fortress
  • This should not be backported
  • I am not sure
  • Other (fill in yourself)

Validation

  • Final regression on Ogre and Ogre2 GL3Plus: 4/4 CTest entries passed.
  • Full serial CTest suite under Xvfb: 257/257 passed.
  • codecheck: cpplint and cppcheck targets passed.
  • Negative control: changing the production condition back to <= 0.0 makes RayQueryTest.RayOriginInsideObjectBounds fail because the result is empty.

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the fix (not needed for this CPU query regression)
  • Added tests
  • Updated documentation (not needed; no public API or documented behavior changed)
  • Updated migration guide (not needed; no migration impact)
  • Consider updating Python bindings (not needed; no API change)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (not needed; no files or targets were added)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

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-by and Generated-by messages.

Backports: If this is a backport, please use Rebase and Merge instead.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

Ogre2 CPU implementation of RayQuery skips over geometry whose AABB contains the origin of the ray

2 participants