Skip to content

Mesh picking plugin's require_markers setting doesn't seem to work correctly #19182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Runi-c opened this issue May 12, 2025 · 1 comment
Closed
Labels
A-Picking Pointing at and selecting objects of all sorts C-Bug An unexpected or incorrect behavior S-Needs-Reproduction Needs an up-to-date or minimal reproduction

Comments

@Runi-c
Copy link

Runi-c commented May 12, 2025

Bevy version

0.16

What you did

While trying to find a workaround for #19181 I tried enabling the require_markers: true setting in MeshPickingSettings, and added the MeshPickingCamera to my cameras and Pickable events to everything I wanted the mouse to interact with.

What went wrong

No picking events were fired at all.

Additional information

If I add a Pickable::default() component to the lowest entity in the hierarchy (not the lowest by depth from camera, nor the highest by depth from camera) then I start receiving picking events for everything in that hierarchy.

As in, in this hierarchy, only the red-dotted entities have Pickable, yet I receive picking events for all the other components, as demonstrated in the following logs:

Image

2025-05-12T06:23:55.849902Z  INFO spacetime::factory::shop: trigger.event().target: 157v1#4294967453 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.849993Z  INFO spacetime::factory::shop: trigger.target(): 113v1#4294967409 (Ok("Shop")
2025-05-12T06:23:55.850070Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.850141Z  INFO spacetime::factory::shop: trigger.event().target: 157v1#4294967453 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.850210Z  INFO spacetime::factory::shop: trigger.target(): 0v1#4294967296 (Err(QueryDoesNotMatch(0v1#4294967296, ArchetypeId(92)))
2025-05-12T06:23:55.851520Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.851614Z  INFO spacetime::factory::shop: trigger.event().target: 160v1#4294967456 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.851702Z  INFO spacetime::factory::shop: trigger.target(): 160v1#4294967456 (Ok("Pipe Bridge Inner")
2025-05-12T06:23:55.851781Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.851866Z  INFO spacetime::factory::shop: trigger.event().target: 160v1#4294967456 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.851958Z  INFO spacetime::factory::shop: trigger.target(): 159v1#4294967455 (Ok("Pipe Bridge")
2025-05-12T06:23:55.852031Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.852104Z  INFO spacetime::factory::shop: trigger.event().target: 160v1#4294967456 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.852183Z  INFO spacetime::factory::shop: trigger.target(): 158v1#4294967454 (Ok("Machine Port")
2025-05-12T06:23:55.852258Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.852321Z  INFO spacetime::factory::shop: trigger.event().target: 160v1#4294967456 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.852390Z  INFO spacetime::factory::shop: trigger.target(): 150v1#4294967446 (Ok("Pipe Switch")
2025-05-12T06:23:55.852509Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.852587Z  INFO spacetime::factory::shop: trigger.event().target: 160v1#4294967456 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.852695Z  INFO spacetime::factory::shop: trigger.target(): 113v1#4294967409 (Ok("Shop")
2025-05-12T06:23:55.852770Z  INFO spacetime::factory::shop: POINTER OUT EVENT
2025-05-12T06:23:55.852853Z  INFO spacetime::factory::shop: trigger.event().target: 160v1#4294967456 (Ok("Pipe Bridge Inner"))
2025-05-12T06:23:55.852933Z  INFO spacetime::factory::shop: trigger.target(): 0v1#4294967296 (Err(QueryDoesNotMatch(0v1#4294967296, ArchetypeId(92)))

If I simply remove the Pickable component from Pipe Bridge Inner then I no longer get any picking events even though all of these entities have Mesh2d.

@Runi-c Runi-c added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 12, 2025
@janhohenheim janhohenheim added A-Picking Pointing at and selecting objects of all sorts S-Needs-Reproduction Needs an up-to-date or minimal reproduction and removed S-Needs-Triage This issue needs to be labelled labels May 12, 2025
@Runi-c
Copy link
Author

Runi-c commented May 13, 2025

Alright, finally tracked this one down - the problem was actually just a silent failure when Pickable is added to a mesh created with RenderAssetUsages::RENDER_WORLD. It just so happened that the bottom-most child in my setup was using a Bevy primitive mesh which stays in the main world and the rest were using custom meshes that unload from the main world. I'll open a new issue suggesting a warning for this case so it's not silent.

@Runi-c Runi-c closed this as completed May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Picking Pointing at and selecting objects of all sorts C-Bug An unexpected or incorrect behavior S-Needs-Reproduction Needs an up-to-date or minimal reproduction
Projects
None yet
Development

No branches or pull requests

2 participants