Open
Description
Bevy version
0.16
What you did
/// Workaround for #19464 change detection broken on [`PickingInteraction`].
#[derive(Component)]
struct PrevPickingInteraction(pub PickingInteraction);
fn save_prev_picking_interaction(
mut query: Query<(Entity, &PickingInteraction, &mut PrevPickingInteraction)>,
) {
for (e, pi, mut ppi) in &mut query {
trace!("hover: e={:?} prev={:?} cur={:?}", e, ppi.0, *pi);
ppi.0 = *pi;
}
}
app.add_systems(First, save_prev_picking_interaction);
What went wrong
The target Mesh2d
is a large-ish rectangle, so there's no change the mouse accidentally leaves it. When slightly moving the mouse around a few pixels, I randomly get a None
for 1 frame, immediately followed by a Hovered
again. This looks like a race condition or timing issue where 1 frame would be skipped for example, and would not detect the mouse temporarily. I'm already working around #19464, and now it seems I also need averaging/smoothing over multiple frames to get a stable hover/non-hover (mouse enter/leave) pair of events. This makes using bevy_picking
pretty cumbersome.
Metadata
Metadata
Assignees
Labels
Pointing at and selecting objects of all sortsAn unexpected or incorrect behaviorA targeted quality-of-life change that makes Bevy easier to useA "normal" level of difficulty; suitable for simple features or challenging fixesNeeds an up-to-date or minimal reproductionThis work is generally agreed upon