You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a great crate so far but what I'm personally missing is a way to see how close a ray was to intersecting when it didn't quite intersect.
The use case I'm imagining is picking meshes with some amount of leniency in precision. For example, in RTS games like Warcraft and Starcraft, you don't have to click exactly on the mesh of a unit to select it. Getting within a certain distance is good enough. This makes the experience for players much better because selecting units is much easier (because you don't have to be super precise).
I don't really see a way to implement this myself downstream, as this crate only provides intersections (do tell me if you think there is a way!). So I guess implementing directly in this crate is the only option.
I thought that perhaps RayCastSource could be extended with the closest approaches like this (names could use work):
where the closest map holds for each entity, the single closest point from the mesh to the ray. (side note: Why is the type of intersections not HashMap<Entity, Vec<Intersection>>?). ClosestPoint (could be named better) would simply be something along the lines of this:
/// The two points that are the closest points between the ray and the triangle.structClosestPoint{ray_point:Vec3,triangle_point:Vec3,origin:Vec3,}implClosestPoint{pubfnnew(ray_point:Vec3,triangle_point:Vec3,origin:Vec3) -> Self{Self{
ray_point,
triangle_point,
origin
}}/// The point on the ray that is closest to the triangle.pubfnray_point(&self) -> Vec3{self.ray_point}/// The point on the triangle that is closest to the ray.pubfntriangle_point(&self) -> Vec3{self.triangle_point}/// The origin of the ray.pubfnorigin(&self) -> Vec3{self.origin}}
Then one could easily check if the ray is "close enough" to select it with some leniency.
Do you see another way of implementing this idea of picking leniency? Maybe I'm missing something obvious. Also is this the right crate to implement this kind of thing in, or should this be in a downstream crate (i.e. bevy_mod_picking)? Otherwise, if you think this is a good idea, I wouldn't mind trying my hand at implementing it and doing a PR.
The text was updated successfully, but these errors were encountered:
This is a great crate so far but what I'm personally missing is a way to see how close a ray was to intersecting when it didn't quite intersect.
The use case I'm imagining is picking meshes with some amount of leniency in precision. For example, in RTS games like Warcraft and Starcraft, you don't have to click exactly on the mesh of a unit to select it. Getting within a certain distance is good enough. This makes the experience for players much better because selecting units is much easier (because you don't have to be super precise).
I don't really see a way to implement this myself downstream, as this crate only provides intersections (do tell me if you think there is a way!). So I guess implementing directly in this crate is the only option.
I thought that perhaps
RayCastSource
could be extended with the closest approaches like this (names could use work):where the
closest
map holds for each entity, the single closest point from the mesh to the ray. (side note: Why is the type ofintersections
notHashMap<Entity, Vec<Intersection>>
?).ClosestPoint
(could be named better) would simply be something along the lines of this:Then one could easily check if the ray is "close enough" to select it with some leniency.
Do you see another way of implementing this idea of picking leniency? Maybe I'm missing something obvious. Also is this the right crate to implement this kind of thing in, or should this be in a downstream crate (i.e. bevy_mod_picking)? Otherwise, if you think this is a good idea, I wouldn't mind trying my hand at implementing it and doing a PR.
The text was updated successfully, but these errors were encountered: