I have this struct
#[derive(Component)]
struct Selectable{
collider: parry3d::shape::Capsule
}
which is used in that function:
let hit = parry3d::query::intersection_test(
&selectable_position,
&selectable.collider,
&Isometry3::identity(),
&collider,
);
Intersection test takes &dyn shape, so a trait object. Now I would actually like to keep it somewhat that generic when calling
commands.spawn((
PbrBundle {
transform: Transform::from_xyz(x, y, z),
mesh: unit_mesh.clone(),
material: unit_material.clone(),
..default()
},
Selectable{collider: parry3d::shape::Capsule::new(Point::new(0.0,-0.5, 0.0), Point::new(0.0, 0.5, 0.0), 0.5)},
));
But since I can't control the lifetime here, I don't see how I'd be supposed to add a trait object to the struct above (which I would like right now).
Also using generics, I would need to specify the generics in the app as I add the system too. So I really don't know how I could pass this whole thing as generic/dynamic.
Any Ideas?