File tree 2 files changed +10
-6
lines changed
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
//! A [`bevy_picking`] backend for sprites. Works for simple sprites and sprite atlases. Works for
2
- //! sprites with arbitrary transforms. Picking is done based on sprite bounds, not visible pixels.
3
- //! This means a partially transparent sprite is pickable even in its transparent areas.
2
+ //! sprites with arbitrary transforms.
3
+ //!
4
+ //! By default, picking for sprites is based on pixel opacity.
5
+ //! A sprite is picked only when a pointer is over an opaque pixel.
6
+ //! Alternatively, you can configure picking to be based on sprite bounds.
4
7
//!
5
8
//! ## Implementation Notes
6
9
//!
@@ -45,9 +48,10 @@ pub enum SpritePickingMode {
45
48
#[ reflect( Resource , Default ) ]
46
49
pub struct SpritePickingSettings {
47
50
/// When set to `true` sprite picking will only consider cameras marked with
48
- /// [`SpritePickingCamera`].
51
+ /// [`SpritePickingCamera`]. Defaults to `false`.
52
+ /// Regardless of this setting, only sprites marked with [`Pickable`] will be considered.
49
53
///
50
- /// This setting is provided to give you fine-grained control over which cameras and entities
54
+ /// This setting is provided to give you fine-grained control over which cameras
51
55
/// should be used by the sprite picking backend at runtime.
52
56
pub require_markers : bool ,
53
57
/// Should the backend count transparent pixels as part of the sprite for picking purposes or should it use the bounding box of the sprite alone.
Original file line number Diff line number Diff line change 1
- //! Demonstrates picking for sprites and sprite atlases. The picking backend only tests against the
2
- //! sprite bounds, so the sprite atlas can be picked by clicking on its transparent areas .
1
+ //! Demonstrates picking for sprites and sprite atlases.
2
+ //! By default, the sprite picking backend considers a sprite only when a pointer is over an opaque pixel .
3
3
4
4
use bevy:: { prelude:: * , sprite:: Anchor } ;
5
5
use std:: fmt:: Debug ;
You can’t perform that action at this time.
0 commit comments