bevy/crates/bevy_sprite
Michael Walter Van Der Velden 93dc596d2e
Add optional transparency passthrough for sprite backend with bevy_picking (#16388)
# Objective

- Allow bevy_sprite_picking backend to pass through transparent sections
of the sprite.
- Fixes #14929

## Solution

- After sprite picking detects the cursor is within a sprites rect,
check the pixel at that location on the texture and check that it meets
an optional transparency cutoff. Change originally created for
mod_picking on bevy 0.14
(https://github.com/aevyrie/bevy_mod_picking/pull/373)

## Testing

- Ran Sprite Picking example to check it was working both with
transparency enabled and disabled
- ModPicking version is currently in use in my own isometric game where
this has been an extremely noticeable issue

## Showcase

![Sprite Picking
Text](https://github.com/user-attachments/assets/76568c0d-c359-422b-942d-17c84d3d3009)

## Migration Guide

Sprite picking now ignores transparent regions (with an alpha value less
than or equal to 0.1). To configure this, modify the
`SpriteBackendSettings` resource.

---------

Co-authored-by: andriyDev <andriydzikh@gmail.com>
2024-12-03 19:32:52 +00:00
..
src Add optional transparency passthrough for sprite backend with bevy_picking (#16388) 2024-12-03 19:32:52 +00:00
Cargo.toml Fix the picking backend features not actually disabling the features (#16470) 2024-11-22 18:14:16 +00:00
README.md Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00

Bevy Sprite

License Crates.io Downloads Docs Discord