bevyengine / bevyengine/bevy

Per `Sprite` `SpritePickingMode`

Open
#23,750 2 comments 0 reactions 0 assignees View on GitHub
A-Picking C-Feature D-Modest S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

I have a `Sprite` that, when read by the `sprite_picking` backend, it thinks it's all zeros (black transparent), so it cannot be picked because it's all under the alpha threshold. This is because it's rendered to by a camera and is not synchronized.

This issue is also relevant to `RENDER_WORLD` only sprites that cannot be read by the `sprite_picking` backend and those who want a tad more performance.

## What solution would you like?

I would like a way to set `SpritePickingMode` on a per-sprite basis.

Implementing this should be trivial, just make `SpritePickingMode` a component or make a wrapper component around it. Then check for its existence in the `sprite_picking` system, if it does, override the `SpritePickingMode`.

## What alternative(s) have you considered?

I could set `SpritePickingMode` with the `SpritePickingSettings` resource. However, the `Sprite` affected is part of a library, and I don't want to force the users of my library to use `SpritePickingMode::BoundingBox` for everything.

Contributor guide

Open the contributing guide

Research direction

Start by reading the SpritePickingMode and SpritePickingSettings definitions and the sprite_picking system. Trace how the system selects a picking mode, then implement the per-Sprite override described in the issue. Done means sprites can independently select their picking mode while the existing global setting remains the fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.