bevyengine / bevyengine/bevy

Unable to handle sprite picking events through RenderTextures

Open
#23,545 5 comments 0 reactions 0 assignees View on GitHub
A-Picking A-Rendering C-Docs D-Straightforward S-Ready-For-Implementation X-Uncontroversial
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version and features

- Forked from 0f6d574d430cb2cf5cbc5d069eb22c1f87442155
- Modified the `sprite_picking` example so correct picking features should be enabled already.

## Relevant system information

- Linux (wayland)
- NVIDIA GeForce RTX 2060 SUPER, driver 595.45.04
- Vulkan backend
- rustc 1.94.0, stable-x86_64-unknown-linux-gnu

## What you did

Modified the `sprite_picking` example to render through a RenderTexture, just like the `pixel_grid_snap` example. A forked repo with minimal code changes can be found here: https://github.com/kfjustis/bevy/tree/sprite_picking_rendertarget

## What went wrong

I expected the same mouse hover/click events to fire as the normal `sprite_picking` example, which should cause the sprites to change color. However, even with the `SpritePickingMode` set to `BoundingBox`, mouse input doesn't seem to affect the sprites.

## Additional information

There is [an older issue here](https://github.com/bevyengine/bevy/issues/22366) related to sprite picking with multiple cameras, but I'm not sure if it's the same bug or not.

It's also possible I just set up the picking incorrectly, so if this is user error, feel free to close this issue.

To test, just build [my forked branch](https://github.com/kfjustis/bevy/tree/sprite_picking_rendertarget) and run:

cargo run --example sprite_picking

Contributor guide

Open the contributing guide

Research direction

Start with the modified `sprite_picking` example on the `sprite_picking_rendertarget` branch and run it with `cargo run --example sprite_picking`. Compare its RenderTexture setup with the `pixel_grid_snap` example and the normal `sprite_picking` example. Done means hover and click events fire through the RenderTexture and the sprites change color with `SpritePickingMode::BoundingBox`.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.