Struct bevy_mod_picking::backend::PointerHits
source · pub struct PointerHits {
pub pointer: PointerId,
pub picks: Vec<(Entity, HitData), Global>,
pub order: f32,
}
Expand description
An event produced by a picking backend after it has run its hit tests, describing the entities under a pointer.
Some backends may only support providing the topmost entity; this is a valid limitation of some backends. For example, a picking shader might only have data on the topmost rendered output from its buffer.
Fields§
§pointer: PointerId
The pointer associated with this hit test.
picks: Vec<(Entity, HitData), Global>
An unordered collection of entities and their distance (depth) from the cursor.
order: f32
Set the order of this group of picks. Normally, this is the [Camera::order
].
Used to allow multiple PointerHits
submitted for the same pointer to be ordered.
PointerHits
with a higher order
will be checked before those with a lower order
,
regardless of the depth of each entity pick.
In other words, when pick data is coalesced across all backends, the data is grouped by
pointer, then sorted by order, and checked sequentially, sorting each PointerHits
by
entity depth. Events with a higher order
are effectively on top of events with a lower
order.
Why is this an f32
???
Bevy UI is special in that it can share a camera with other things being rendered. in order to properly sort them, we need a way to make bevy_ui’s order a tiny bit higher, like adding 0.5 to the order. We can’t use integers, and we want users to be using camera.order by default, so this is the best solution at the moment.
Implementations§
Trait Implementations§
source§impl Clone for PointerHits
impl Clone for PointerHits
source§fn clone(&self) -> PointerHits
fn clone(&self) -> PointerHits
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PointerHits
impl Debug for PointerHits
impl Event for PointerHitswhere PointerHits: Send + Sync + 'static,
Auto Trait Implementations§
impl RefUnwindSafe for PointerHits
impl Send for PointerHits
impl Sync for PointerHits
impl Unpin for PointerHits
impl UnwindSafe for PointerHits
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.