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:

unreal-screen-edge-example

 

The function:

unreal-screen-edge

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.

unreal-screen-edge-correction

Cheers,

lith

The current state of Ivanov

Here’s a peek at where I’ve got to with my UE4 Gamejam entry ‘Ivanov’. It’s getting towards being a playable game now, I’m fairly pleased with how it’s going.

You can’t see the cursor, but when the character moves it’s being dragged. Intended to work on tablets.

You leave an egg at each planet. Have to leave at least x eggs in each system but limited amount of time/hops to do it. Different planets give different effects/bonuses, like more time/energy/clones.

lith