Skip to content

Commit e763b71

Browse files
globinaevyrie
andauthored
picking: disable raycast backface culling for Mesh2d (#16657)
# Objective - This fixes raycast picking with lyon - reverse winding of 2D meshes currently results in them being rendered but not pickable as the raycast passes through the backface and would only hit "from below" ## Solution - Disables backface culling for Mesh2d ## Testing - Tested picking with bevy_prototype_lyon - Could probably use testing with Mesh3d (should not be affected) and SimplifiedMesh (no experience with that, could have the same issue if used for 2D?) --------- Co-authored-by: Aevyrie <[email protected]>
1 parent d3241c4 commit e763b71

File tree

1 file changed

+4
-3
lines changed
  • crates/bevy_picking/src/mesh_picking/ray_cast

1 file changed

+4
-3
lines changed

crates/bevy_picking/src/mesh_picking/ray_cast/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,10 @@ impl<'w, 's> MeshRayCast<'w, 's> {
274274
return;
275275
};
276276

277-
let backfaces = match has_backfaces {
278-
true => Backfaces::Include,
279-
false => Backfaces::Cull,
277+
// Backfaces of 2d meshes are never culled, unlike 3d mehses.
278+
let backfaces = match (has_backfaces, mesh2d.is_some()) {
279+
(false, false) => Backfaces::Cull,
280+
_ => Backfaces::Include,
280281
};
281282

282283
// Perform the actual ray cast.

0 commit comments

Comments
 (0)