Download

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.

3dd5dd2a583c47e49e4363e31ec437f256aa9fa7.png

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.

Cheers,

Tom

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?