bevy/crates
Sorseg 30a022feae Make RayMap map public (#18544)
Migration guide:
# Objective

Currently there seems to be no way to enable picking through
render-to-texture cameras

## Solution

This PR allows casting rays from the game code quite easily.

## Testing

- I've tested these in my game and it seems to work
- I haven't tested edge cases

--- 

## Showcase

<details>
  <summary>Click to view showcase</summary>

```rust

fn cast_rays_from_additional_camera(
    cameras: Query<(&GlobalTransform, &Camera, Entity), With<RenderToTextureCamera>>,
    mut rays: ResMut<RayMap>,
    pointers: Query<(&PointerId, &PointerLocation)>,
) {
    for (camera_global_transform, camera, camera_entity) in &cameras {
        for (pointer_id, pointer_loc) in &pointers {
            let Some(viewport_pos) = pointer_loc.location() else {
                continue;
            };
            // if camera result is transformed in any way, the reverse transformation
            // should be applied somewhere here
            let ray = camera
                .viewport_to_world(camera_global_transform, viewport_pos.position)
                .ok();
            if let Some(r) = ray {
                rays.map.insert(RayId::new(camera_entity, *pointer_id), r);
            }
        }
    }
}

```

</details>

## Migration Guide
The `bevy_picking::backend::ray::RayMap::map` method is removed as
redundant,
In systems using `Res<RayMap>` replace `ray_map.map()` with
`&ray_map.map`
2025-03-25 22:59:05 +01:00
..
bevy_a11y Update accesskit and accesskit_winit requirements (#18285) 2025-03-25 22:44:01 +01:00
bevy_animation Reduce dependencies on bevy_render by preferring bevy_mesh imports (#18437) 2025-03-25 22:45:39 +01:00
bevy_app Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_asset Don't panic on temporary files in file watcher (#18462) 2025-03-25 22:45:41 +01:00
bevy_audio Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_color Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_core_pipeline Record bloom render commands in parallel (#18330) 2025-03-25 22:44:01 +01:00
bevy_derive Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_dev_tools Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_diagnostic Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_dylib Switch from OnceCell to LazyLock in bevy_tasks (#18506) 2025-03-25 22:41:01 +01:00
bevy_ecs Define system param validation on a per-system parameter basis (#18504) 2025-03-25 22:59:04 +01:00
bevy_encase_derive Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_gilrs Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_gizmos Define system param validation on a per-system parameter basis (#18504) 2025-03-25 22:59:04 +01:00
bevy_gltf Reduce dependencies on bevy_render by preferring bevy_mesh imports (#18437) 2025-03-25 22:45:39 +01:00
bevy_image Ensure dds enables bevy_core_pipeline/dds in bevy_anti_aliasing (#18484) 2025-03-24 00:11:37 +01:00
bevy_input Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_input_focus Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_internal Fix bevy_math/transform/input Improper Inclusion (#18526) 2025-03-25 22:59:04 +01:00
bevy_log Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_macro_utils Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_math Add no_std compatible ceil method (#18498) 2025-03-25 22:59:04 +01:00
bevy_mesh Reduce dependencies on bevy_render by preferring bevy_mesh imports (#18437) 2025-03-25 22:45:39 +01:00
bevy_mikktspace Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_pbr Move non-generic parts of the PrepassPipeline to internal field (#18322) 2025-03-25 22:59:04 +01:00
bevy_picking Make RayMap map public (#18544) 2025-03-25 22:59:05 +01:00
bevy_platform_support Address lints in bevy_platform_support (#18477) 2025-03-24 00:09:30 +01:00
bevy_ptr Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_reflect Update bincode to 2.0 (#18396) 2025-03-25 22:44:01 +01:00
bevy_remote fix error and lints when building for wasm32 (#18500) 2025-03-24 00:14:22 +01:00
bevy_render Define system param validation on a per-system parameter basis (#18504) 2025-03-25 22:59:04 +01:00
bevy_scene Update bincode to 2.0 (#18396) 2025-03-25 22:44:01 +01:00
bevy_sprite don't flip sprites twice (#18535) 2025-03-25 22:59:04 +01:00
bevy_state Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_tasks Switch from OnceCell to LazyLock in bevy_tasks (#18506) 2025-03-25 22:41:01 +01:00
bevy_text ExtractedSprites slice buffer (#17041) 2025-03-25 22:43:58 +01:00
bevy_time Fix clippy::unnecessary-literal-unwrap in bevy_time (#18485) 2025-03-24 00:14:22 +01:00
bevy_transform Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_ui Update accesskit and accesskit_winit requirements (#18285) 2025-03-25 22:44:01 +01:00
bevy_utils Release 0.16.0-rc.1 2025-03-18 21:48:22 +01:00
bevy_window Replace VisitEntities with MapEntities (#18432) 2025-03-24 00:09:29 +01:00
bevy_winit Update accesskit and accesskit_winit requirements (#18285) 2025-03-25 22:44:01 +01:00