You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I integrated bevy_mod_picking into my project today and found it somewhat unexpected (and problematic for my use case) that all UI nodes, including those having no visible geometry, will block picking.
To my understanding, bevy_ui's Node component represents a logical node in the layout hierarchy of the UI, which is not necessarily a piece of rendered geometry. It therefore seems strange that the default BevyUiBackend performs picking against all UI nodes, with no distinction whether they contain visible geometry or not.
I think it would be much more sensible if the default UI backend only considered a node for picking if it actually contains rendered geometry, such as if it has a BackgroundColor component with a non-zero alpha, or a UiImage component. The Pickable component could be used to enable picking of invisible nodes if this should be desired.
The current behaviour leads to some undesirable results:
Invisible container nodes will block picking, which can be unexpected. It is common to use such container nodes for layout purposes, in which case you generally don't want picking to be blocked.
A potentially unwanted behaviour (blocking of picking) is implicitly imparted upon all UI by default, which means that you may have to modify your UI just to get picking to work as expected. It could also lead to problems with third-party plugins, where you are unable to make changes to the source. Ideally, you shouldn't have to add Pickable components to entities that don't have anything to do with picking (i.e. not intended to block or receive events), and you shouldn't be forced to layout your UI in a specific way just to not interfere with picking.
In my case, this became problematic because my project made use of a lot of invisible layout containers for the UI, which effectively blocked all picking interactions with 3D objects.
I think this could be fixed relatively easily by just a few modifications to the UI picking backend, checking for the components mentioned above. I could likely submit a PR if it is agreed that this change would be useful. Note however that this would entail a change in default behaviour, which could impact existing users somewhat.
Note: I am aware that view visibility is currently taken into account, and that non-visible nodes, i.e. those who are ViewVisibility::Hidden are not considered for picking. However, there is a fine distinction between being set to hidden versus not possessing any visible geometry at all, especially since view visibility is (normally) an inherited property.
Lastly, thank you for this awesome plugin! :)
The text was updated successfully, but these errors were encountered:
I integrated
bevy_mod_picking
into my project today and found it somewhat unexpected (and problematic for my use case) that all UI nodes, including those having no visible geometry, will block picking.To my understanding, bevy_ui's
Node
component represents a logical node in the layout hierarchy of the UI, which is not necessarily a piece of rendered geometry. It therefore seems strange that the defaultBevyUiBackend
performs picking against all UI nodes, with no distinction whether they contain visible geometry or not.I think it would be much more sensible if the default UI backend only considered a node for picking if it actually contains rendered geometry, such as if it has a
BackgroundColor
component with a non-zero alpha, or aUiImage
component. ThePickable
component could be used to enable picking of invisible nodes if this should be desired.The current behaviour leads to some undesirable results:
Pickable
components to entities that don't have anything to do with picking (i.e. not intended to block or receive events), and you shouldn't be forced to layout your UI in a specific way just to not interfere with picking.In my case, this became problematic because my project made use of a lot of invisible layout containers for the UI, which effectively blocked all picking interactions with 3D objects.
I think this could be fixed relatively easily by just a few modifications to the UI picking backend, checking for the components mentioned above. I could likely submit a PR if it is agreed that this change would be useful. Note however that this would entail a change in default behaviour, which could impact existing users somewhat.
Note: I am aware that view visibility is currently taken into account, and that non-visible nodes, i.e. those who are
ViewVisibility::Hidden
are not considered for picking. However, there is a fine distinction between being set to hidden versus not possessing any visible geometry at all, especially since view visibility is (normally) an inherited property.Lastly, thank you for this awesome plugin! :)
The text was updated successfully, but these errors were encountered: