-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement bounding volume intersections #11439
Implement bounding volume intersections #11439
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency I'd change the < to <=, but other than that I haven't noticed any problems.
Co-authored-by: IQuick 143 <IQuick143cz@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems correct. Didn't check the tests tho. And closest_point
on sphere/circle appears to be unused. It might be useful, but I also feel like maybe it should be on the primitive types instead.
For now, I moved the circle/sphere |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good.
Although I'm not super convinced about implementing closest point on the primitives, because closest point seems to demand transform information (translation + rotation), which is addressed here by assuming default identity transform.
It's not a huge deal, because the user can use this to implement the general case simply by inversely transforming the point and then transforming the result.
FWIW, Parry has "global" and local versions of a ton of methods, like The |
Here's a video of the bounding volume intersections working: (gray is the bounding volume) 2024-01-20.23-07-29.mp4I can add this as an example if that'd be useful. Should I do it in this PR or a follow-up? |
I guess a follow up PR that showcases the intersection tests (including raycasting and later sphere/aabb casting) and bounding types makes sense? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Great docs, and thanks for including thorough tests.
Objective
#10946 added bounding volume types and an
IntersectsVolume
trait, but didn't actually implement intersections between bounding volumes.This PR implements AABB-AABB, circle-circle / sphere-sphere, and AABB-circle / AABB-sphere intersections.
Solution
Implement
IntersectsVolume
for bounding volume pairs. I also addedclosest_point
methods to return the closest point on the surface / inside of bounding volumes. This is used for AABB-circle / AABB-sphere intersections.