Implement bounding volume intersections#11439
Implement bounding volume intersections#11439alice-i-cecile merged 7 commits intobevyengine:mainfrom
Conversation
IQuick143
left a comment
There was a problem hiding this comment.
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>
NiseVoid
left a comment
There was a problem hiding this comment.
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 |
IQuick143
left a comment
There was a problem hiding this comment.
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? |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Looks good. Great docs, and thanks for including thorough tests.
Objective
#10946 added bounding volume types and an
IntersectsVolumetrait, 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
IntersectsVolumefor bounding volume pairs. I also addedclosest_pointmethods to return the closest point on the surface / inside of bounding volumes. This is used for AABB-circle / AABB-sphere intersections.