-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
Give access to body set in broad phase filter #278
Give access to body set in broad phase filter #278
Conversation
A quick rehash of my notes from Discord: The
The first version seemed less than ideal, considering that the mechanical world is also currently not constrained by the set types. It seemed good to keep that, however it might provide a better API. Additionally, it seems likely that any filter will actually be a ZST meaning creating the filter every frame will be a no-op. That worked out well once it became clear how many times the filter would need to be passed into the geometrical world - adding a |
I should find time to get this fully finished in the next few days. |
While making these updates, I found a situation that I had not considered as it wasn't relevant to my use-case: needing dynamic filters. The physics testbed, for example, should have dynamic filters in order to enable filtering while not parameterizing the testbed on the filter. The current state of this pull request is such that dynamic filters cannot exist in any form due to the An alternative that seems appealing to me would be to remove the * Also |
New branch because I didn't want this to update the pull request. Please don't include this commit in the history, Nate.
So this is finally in a working state. A history of how it got to this form can be found here but basically I removed the A few things to note. First, this requires ncolide#361 to be merged. Second, right now I define a type EDIT: It might be worth making the filter take mutable references for |
I have modified my work code to use this branch and I am pretty satisfied with the results. Currently, some vague knowledge of HRTBs is required to have run-time determined filters but the addition of a few type aliases might mostly solve that problem: pub type FilterObject<N, Bodies, Colliders> = dyn for<'a> BroadPhasePairFilter<N, BroadPhaseCollisionSet<'a, N, Bodies, Colliders>>;
pub type BoxedFilter<N, Bodies, Colliders> = Box<FilterObject<N, Bodies, Colliders>>; The library consumer will still have to understand HRTBs in order to use generics with the filter but using a I haven't pushed those type aliases yet because they're probably worth discussing (or at least coming up with a better name) and I'm not sure what module they should go in. |
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.
Thank you for this PR!
Could you please bump the dependencies versions to use kiss3d v0.26, and ncollide v0.25?
Cargo.toml
Outdated
ncollide2d = { path = "../ncollide/build/ncollide2d" } | ||
ncollide3d = { path = "../ncollide/build/ncollide3d" } | ||
kiss3d = { path = "../kiss3d" } |
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 should be left commented.
As per the comment on the Github pull request.
I believe I got all of them. Any thoughts on the names and type aliases? |
Thanks! Regarding the naming I think it would make more sense if:
|
Thanks! |
Meant to be paired with ncollide#359.
This utilizes the new formulation of the
BroadPhasePairFilter
trait to supply both theBodySet
andColliderSet
to the broad phase pair filter. This allows for the filter to take into account information that exists in the body, such as multibody link ancestry, velocity, etc.From the user's perspective, this removes
GeometricalWorld::set_broad_phase_pair_filter
and provides aMechanicalWorld::step_with_filter(.., impl BroadPhasePairFilter)
where the filter has access to the body set.