#[derive(SystemParam)] with inner query filter #4398
-
I have a derived system param: #[derive(SystemParam)]
pub struct SolidObjects<'w, 's> {
objects: Query<
'w,
's,
(
Entity,
&'static GlobalTransform,
&'static Aabb,
&'static Handle<Mesh>,
),
>,
meshes: ResMut<'w, Assets<Mesh>>,
}
impl<'w, 's> SolidObjects<'w, 's> {
pub fn ray_intersection(&self, ray: &Ray) -> Option<(Entity, RayIntersection)> {}
} I want to extend this to enable query filtering. Something like this: #[derive(SystemParam)]
pub struct SolidObjects<'w, 's, F>
where
F: WorldQuery + Sync + Send + 'static,
<F as WorldQuery>::Fetch: FilterFetch,
{
objects: Query<
'w,
's,
(
Entity,
&'static GlobalTransform,
&'static Aabb,
&'static Handle<Mesh>,
),
F,
>,
meshes: ResMut<'w, Assets<Mesh>>,
} But it won't compile:
Can someone hint me to what I am doing wrong? |
Beta Was this translation helpful? Give feedback.
Answered by
TheRawMeatball
Apr 3, 2022
Replies: 1 comment 4 replies
-
Moving the bounds on F from where to being directly on the declaration should make this compile. The where filters not being carried properly seems to be a bug. |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
Indy2222
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moving the bounds on F from where to being directly on the declaration should make this compile. The where filters not being carried properly seems to be a bug.