Smart method to get Entity when hovering it with mouse for 2d
Hello,
is it possible to have something equivalent than bevy_mod_picking https://github.com/aevyrie/bevy_mod_picking
which works for 3d , but here for 2d ?
i tried to get inspiration from buttons , but it is not clean to put this kind of component everywhere. I dont know how to writte this kind of method.
I'd like to hover sprites , click on it to select it , or click and drag to draw a rectangle which select a vector or entities.
So i need to get entity / entities when the mouse hovers sprite(s). very usefull++
I've done this with rapier colliders: https://docs.rs/bevy_rapier2d/latest/bevy_rapier2d/prelude/struct.QueryPipeline.html#method.intersections_with_point
I also filed https://github.com/aevyrie/bevy_mod_picking/issues/130 to get Lyon support.
This has been added to bevy_mod_raycast: https://github.com/aevyrie/bevy_mod_raycast/pull/38 Currently downstreaming into bevy_mod_picking.
I just created a very simple plugin for this.
https://github.com/xavierwoo/bevy_cursor_hovering_sprite
Hope it meet your need.
thank you !
Le sam. 1 juin 2024 à 16:42, Xinyun Wu @.***> a écrit :
I just create a very simple plugin for this.
https://github.com/xavierwoo/bevy_cursor_hovering_sprite
Hope it meet your needs.
— Reply to this email directly, view it on GitHub https://github.com/bevyengine/bevy/issues/3805#issuecomment-2143471893, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATQR4NZ5WIUZXUHASYE7H3TZFHMUJAVCNFSM5NDNIX22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJUGM2DOMJYHEZQ . You are receiving this because you authored the thread.Message ID: @.***>
I'm guessing that the Sprite Picking example is exactly what is described here?
- https://bevyengine.org/examples/picking/sprite-picking/
- https://github.com/bevyengine/bevy/blob/release-0.16.0/examples/picking/sprite_picking.rs
Yes, closing.