Download

How do i know which widget is under absolute viewport location?

How do i know which widget is under absolute viewport location?

I need to know if this is even possible, so far i could not find a way to check if widget is under location
or to get its absolute location in viewport.

there is node “is under location” but it always returns false even if i aim at center of widget.
and there is “position|” node but this one always return relative location to parent.
and then obfuscated by anchors and margins etc, do decrypt it all i doubt blueprints are enough.

Ps.
There is even more confusion. I use “convert world location to screen location” then place widget at that location on umg canvas.
I am using upper left anchor so coordinates should be same for both widget and absolute screen location.
And results given me by it are off by x=+200 and y=+45.

PPS.
And even more messed up stuff. I get raw touch event location from “Get input touch state” and plug it directly to location of widget.
Looks like resolution of touch coordinates (ie max x,y for touch) is different than viewport resolution and both are different than UMG resolution.

So to precisely aim with touch, i need to line up 3 different coordinate systems:
real world results from “convert world location to screen location”
touch event coordinates in touch event space
umg position for umg items

Each probably having slightly different aspect ratio and on top of that it depends on device rendering.
Could it be any more complicated?

I know this is incredibly late :slight_smile:

But for anyone finding this thread with the same question…

To find whether or not the mouse is over a widget in screen space:

Simple use the “Is Hovered” pure function in the widget event graph with ‘self’ as the target. This will return true when the mouse is over any aspect of the widget (components included)

and false when its not.

Hope this helps!

I solved it some years ago. However for simplicity of code i just checked if touch event (mouse) is either in predefined box, or in circle around point.
UMG (back then) did not register pointer (touch point) leaving widget area in some cases, so for arcade game it was useless.
Also multiple touch points with UMG, that is even bigger can of worms.