UE4 Screen Edge location

I’ve seen various requests for how to calculate the screen x,y coords of an off-screen object and the point on the edge closest to it – using Blueprints.

I saw them because I was looking for a way to do it and didn’t like what I found, so I’ve made my own and I hope this will help others.

Below is a sample of it in use, and the blueprint screengrab below that:



The function:


It returns the point on the edge of the screen that’s between the center of the screen and the target point if you draw a straight line in 3D space between the two. It also takes a margin (0 = no margin, 1 = center of screen, 0.5 = half way between those) if you don’t want to use the actual screen edge for whatever reason. It should cope with different screen resolutions and aspects without any trouble.

It also returns the float angle in degrees heading towards the target – used above to orient the arrows.

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.




2 thoughts on “UE4 Screen Edge location”

  1. I tried it out.. seems like the angle works for me but not the Set Position in Viewport for the widget… :/ I made sure I added the ABS like u said …

    1. Nevermind! I realized it was working but the image was just outside the screenspace at margin 0, if I do 0.1 I can see it fine 🙂

Leave a Reply to Vince Cancel reply

Your email address will not be published. Required fields are marked *