How do I check if a UI element is overlapping an actor?

How do I check if a UI element is overlapping an actor?

For instance, say I have a translucent square in the middle of my screen as a reticle, as shown in the included image. When that square is over a certain actor, be it a person, box, etc, an action occurs.

Is there a way to do this?

Any help would be greatly appreciated.
Thanks!

30126-hudsnip.png

I don’t think you can detect an actual overlap event since the widget doesnt exist in the same space as the world.

What I would do is a constant Box Line Trace from the center of the screen forwards and detect what it hits. Probably not every frame since I imagine that can get expensive, but maybe on a 0.1/0.2s looping timer.

I see. The problem with a box trace, for me, is perspective.
For example, if we take our hand and make a circle, and move far away from a large object, even if that object isn’t in the center of our circle-hand, it can still be in it. However, if we do a box trace/sphere trace, etc, it does not take into account perspective. the trace point right in front of me isn’t the same size as it is a few meters away, from a 2D perspective.

I’ve tried converting information into 2D but I’ve been having difficulties with it. Perhaps that’s a question for a separate post. Thanks for your response!

I haven’t seen anything or been able to check if a ui object overlaps. so I’ll assume that aspect is correct.