Skip to content

Commit

Permalink
Fix 2d mesh raycasting
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Aug 22, 2023
1 parent 867c231 commit 3c3fea0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.13.1

- Fixed: overly-strict query filter preventing raycasting 2d meshes.

# 0.13.0

- Changed: the immediate mode raycasting system param `Raycast` no longer requires a type parameter
Expand Down
7 changes: 6 additions & 1 deletion src/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ impl<'a> Default for RaycastSettings<'a> {
}
}

#[cfg(feature = "2d")]
type MeshFilter = Or<(With<Handle<Mesh>>, With<Mesh2dHandle>)>;
#[cfg(not(feature = "2d"))]
type MeshFilter = With<Handle<Mesh>>;

/// A [`SystemParam`] that allows you to raycast into the world.
#[derive(SystemParam)]
pub struct Raycast<'w, 's> {
Expand All @@ -86,7 +91,7 @@ pub struct Raycast<'w, 's> {
Read<GlobalTransform>,
Entity,
),
With<Handle<Mesh>>,
MeshFilter,
>,
pub mesh_query: Query<
'w,
Expand Down

0 comments on commit 3c3fea0

Please sign in to comment.