-
-
Notifications
You must be signed in to change notification settings - Fork 122
QueryOptions parameters (GjkOptions) #298
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
base: master
Are you sure you want to change the base?
Conversation
b3b83c1
to
e9cf114
Compare
…fix more path to eps_tol(), but serves as discussion starter
… shapes knowing their underlying algorithm.
It's not straightforward to do, that will likely need a solution similar to a dispatcher
02a37ec
to
ca45b43
Compare
#[cfg(feature = "alloc")] // TODO: can’t be used without alloc because of EPA | ||
{ | ||
let Some(options) = options.as_any().downcast_ref() else { | ||
warn!("Incorrect option passed to project_local_point: using default options."); |
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.
I'm not a huge fan of these warnings:
- I'd like to make it easy for users to use the "simple API" (pass default options)
- We can make a
project_local_point_with_query_options
, but I'm not sure duplicating API is great - I chose to support
&()
as parameter which will be interpreted as default options later- Going this path means we should not warn if user passed
&()
.
- Going this path means we should not warn if user passed
- We can make a
|
(TypeId::of::<Compound>(), self_ref), | ||
#[cfg(feature = "dim2")] | ||
( | ||
TypeId::of::<crate::shape::ConvexPolygon>(), | ||
gjk_options.clone(), | ||
), | ||
#[cfg(feature = "dim3")] | ||
(TypeId::of::<crate::shape::ConvexPolyhedron>(), gjk_options), |
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.
Do roundshapes and other container shapes need to be specific ? like TypeId::of::<RolunShape<crate::shape::ConvexPolyhedron>>()
?
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.
No: roundshapes use support point algorithm which is gjk options.
// FIXME: This needs a query option dispatcher, because a user custom shape against a ball may need a different option. | ||
// Currently, some paths lead to an unused option. | ||
// (Gjk is used for intersections with convex shapes and cylinder) | ||
&self.gjk_options, |
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 is an important point to tackle.
Following discussion on discord, a shape cast of a ball sometimes fails when it should not.
time_of_impact_support_map_support_map
returnsNone
when it shouldn't with very specific inputs #180Current status
GjkOptions
, this is very breaking as it impactsPointQuery
trait.DefaultQueryDispatcher
stores relevant options to pass to their algorithms.DefaultQueryDispatcher
to handle user-defined algorithms (and more elegantly our convex polygons).intersection_test_point_query_ball
(https://github.com/dimforge/parry/pull/298/files#r2230938921)QueryOoptionsNotUsed
in algorithms to make it easier to understand which paths need an option and which don´t. Ideally an associated trait would be used but it makes it difficult to mix different shapes...contains_local_point_with_option
? to make the API more straightforward by default, but I'm not a huge fan of duplicated entriesBefore this PR:
After this PR, with customizable Gjk epsilon changing each frame:
Screencast.from.07-24-2025.04.49.01.PM.webm
I added an example for compound shape point query (using convex polygon, to test dispatching gjk options), and the result was showing false negatives (without custom gjk options ; multiplying the epsilon by 100 fixes it.):
Screencast.from.07-16-2025.04.09.26.PM.webm