Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picking should take the sprite's rect into consideration. #353

Open
Sigma-dev opened this issue Jul 23, 2024 · 1 comment
Open

Picking should take the sprite's rect into consideration. #353

Sigma-dev opened this issue Jul 23, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Sigma-dev
Copy link

Right now, Sprite picking works just fine, until you start using the sprite's optional rect property.

The rect is used in many cases, one of the most popular being getting individual frames from a spritesheet.
This results in the sprite rect and therefore the size of the actual sprite being much smaller than the bounds (that cover the whole sheet).
Since bevy_mod_picking only considers the sprite's bounds, then the sprite's actual picking zone is much bigger than it should be, rendering it unusable in many situations.

What I propose is that the bevy_mod_picking instead looks at both the bounds and the rect to determine what area is actually the sprite.

PS: I understand this might not be possible and there might be edge cases or other factors i'm not seeing. There might also be some fix/solution i'm not aware of.

@aevyrie
Copy link
Owner

aevyrie commented Jul 24, 2024

This would need to be added to the sprite picking backend, for anyone interested in adding this.

https://github.com/aevyrie/bevy_mod_picking/blob/main/backends/bevy_picking_sprite/src/lib.rs

@aevyrie aevyrie added enhancement New feature or request good first issue Good for newcomers labels Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants