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 <aevyrie@gmail.com>
This commit is contained in:
Robin Gloster 2024-12-05 21:22:29 +00:00 committed by François Mockers
parent 38bbb677c5
commit 4998b9d0c5

View File

@ -274,9 +274,10 @@ impl<'w, 's> MeshRayCast<'w, 's> {
return; return;
}; };
let backfaces = match has_backfaces { // Backfaces of 2d meshes are never culled, unlike 3d mehses.
true => Backfaces::Include, let backfaces = match (has_backfaces, mesh2d.is_some()) {
false => Backfaces::Cull, (false, false) => Backfaces::Cull,
_ => Backfaces::Include,
}; };
// Perform the actual ray cast. // Perform the actual ray cast.