Off-screen indicators

My first post, so Hi!

I noticed a few requests for blueprint based off-screen indicators so I’ve put together a function that calculates the position of them around the screen edge and the angle that points to the off-screen object. I don’t think it’s already been done but apologies if it has and I missed it.
It works by calculating the vector pointing from the center of the screen to the object in 3D space and converting to 2D and finding where that intersects the screen edge.

There’s a bit more detail at SafeFromRobots.

Let me know if you find any problems with it but I believe it’s fairly robust and will deal with different resolutions/aspect ratios without trouble.

Edit: There should be an ABS node in “Use resulting screen coord to find screen edge and angle”, just after the first “+” node. Of course I discovered it immediately after posting this. D’oh.



Tom Macneil

Safe From Robots


Hi Tom H,

Thanks for the nodes. This worked fine for me but I did find that at large distances away from world origin, the accuracy of the WorldToScreen and ScreenToWorld became erratic. In my test to replicate the issue (and hopefully fix it after this post), I sat out at roughly -900,000 units. Any movement from the player controller causes the values to jump even when objects are stationary. It feels like super-sensitivity of the values because of the distance. Almost like there is a calculation somewhere in the conversion that uses world origin and the projection distance is creating a wider range of values for equivalent screen space ratio.

I shall play and if I figure it out I will come back and post.

Could you please post a tutorial where you actually order ui widget to point to tracked object off-screen? I’m struggling with this part so hard and having very odd results. I’m not so proficient in UE. Thanks in advance for any tip!

The code was only working for me on 1080 resolution. I solved it by dividing these values by the viewport scale.

Moreover, I won’t use it for now, but I think the angle is inversed. I mean, the image I use as indicator is focusing outside when it’s on the x edges, while it’s focusing inside when it’s on the y edges.

Does this work when you turn completely around as well?

This is driving me nuts, the original screenshot is down. Mind reposting it?

1 Like

Trying to use this BP in a top down XY viewport and have a problem. When character is on the right/down side of the object it works fine, but when it comes to the left/top side - indicator points to the opposite direction.

PS: removed the ABS node wich was proposed by original author in a fix. Overwise it always point in opposite direction.

Can someone take a look at it? You would help a lot. Thanks.
Widget: Simple widget with image in center
Run part:

Function code
func.txt (151.0 KB)

vars.txt (3.1 KB)


Well, I ended up making my own solution from scratch.

Almost 9 years later, thank you for sharing! It works perfectly.