bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Smart method to get Entity when hovering it with mouse for 2d

Open pyweeker opened this issue 4 years ago • 5 comments

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++

pyweeker avatar Jan 29 '22 22:01 pyweeker

I've done this with rapier colliders: https://docs.rs/bevy_rapier2d/latest/bevy_rapier2d/prelude/struct.QueryPipeline.html#method.intersections_with_point

SUPERCILEX avatar Apr 29 '22 06:04 SUPERCILEX

I also filed https://github.com/aevyrie/bevy_mod_picking/issues/130 to get Lyon support.

SUPERCILEX avatar Apr 29 '22 07:04 SUPERCILEX

This has been added to bevy_mod_raycast: https://github.com/aevyrie/bevy_mod_raycast/pull/38 Currently downstreaming into bevy_mod_picking.

aevyrie avatar May 22 '22 06:05 aevyrie

I just created a very simple plugin for this.

https://github.com/xavierwoo/bevy_cursor_hovering_sprite

Hope it meet your need.

xavierwoo avatar Jun 01 '24 14:06 xavierwoo

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: @.***>

pyweeker avatar Aug 24 '24 08:08 pyweeker

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

erictuvesson avatar May 16 '25 00:05 erictuvesson

Yes, closing.

aevyrie avatar May 20 '25 06:05 aevyrie