diff --git a/backends/bevy_picking_sprite/src/lib.rs b/backends/bevy_picking_sprite/src/lib.rs index 1d6f799c..1df0f355 100644 --- a/backends/bevy_picking_sprite/src/lib.rs +++ b/backends/bevy_picking_sprite/src/lib.rs @@ -81,7 +81,13 @@ pub fn sprite_picking( continue; }; - let Some(cursor_pos_world) = camera.viewport_to_world_2d(cam_transform, location.position) + let viewport_pos = camera + .logical_viewport_rect() + .map(|v| v.min) + .unwrap_or_default(); + let pos_in_viewport = location.position - viewport_pos; + + let Some(cursor_pos_world) = camera.viewport_to_world_2d(cam_transform, pos_in_viewport) else { continue; };