Is there a way to specify a shape when enabling mouse filtering on a control?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By brazmogu

Okay, so I’m making a HUD for my game, which controls a lot like a PC RTS (right click on map to move unit, etc) and so the map shouldn’t receive mouse events “under” the UI. That’s simple enough with mouse filtering, alright.

Thing is, my HUD has this shape where you can see the map through a “cut” in the inner border (pictured below), but Godot seemingly only assumes the total area of my HUD’s texture to be it’s collision area and will either filter nothing at all, or block clicks done on the map through this cut.

The HUD's bottom panel, with a "cut' on the middle top part

Is there some way of defining the shape of a Control node’s filter area? So far the only idea that comes to mind would be making a polygon 2D collider that follows the camera, and that seems way too hacky…

from what I know, buttons only possess the capability of the things you say.
So you need to change the type of your control node into a button. and once you do that, you’ll just create a click mask of it.
This also adds a new effects like dynamic HUD etc. but if you want to just be plain, make sure that ‘pressed’ ‘hover’ ‘disabled’ ‘normal’ is the same texture.

Mrpaolosarino | 2021-04-22 05:33

I don’t think this is possible, but you can suggest it on the proposals GitHub.

exuin | 2021-04-22 15:09