How do I make my enemy HP show up only when they are in middle of my crosshair?

I have a static image crosshair (circular crosshair) made in UMG that is placed in middle of the screen. I attached a HP bar on a dummy actor that rotates towards the player so the HP bar is always visible to the player. I want to only show the HP bar when I aim my crosshair on my dummy actor.

I figured that I would have to mess with the screen coordinates and world coordinates but I have no clue how to do that. I also thought that this problem could also be fixed using a line tracer by channel but it would not show the dummy HP bar at long distances.

There are two ways to do this that I can think of.

Either use a line (or another type of trace) trace on Event Tick (this may not be super efficient), that reaches out X units and sets the healthbar visibility, or you could attach an invisible cylinder to your character and set up an event on overlap to set the healthbar as visible.

The cylinder is sloppy, because it counts as part of your actor. Therefore, it would trigger overlap events with your character.

The line trace is cleaner but requires the use of event tick, unless you can come up with a new way to trigger the hit trace (for instance, every time you fire a shot at a target or hit a certain button, trigger the line trace).

That's a video on how to use line trace.

well with overlapping you can do specific components as you should. There really shouldn’t be anything/much to effect when overlapping any component of the character.