How to figure out visible bounds at a certain height?

Hi folks, I’m creating a SHMUP game and I’m trying to establish the visible bounds of the viewport at the height at which the player flies (their height doesn’t change).

The way I’ve tried to do it is to take each of the corner points of the viewport in screen space, convert those to world space with a “Player Controller → Deproject Screen to World” Blueprints node, then use a “Line Plane Intersection (Origin & Normal)” node to intersect with a plane at the player’s height using the Up vector of the player actor. This almost gives me what I want, except that using the direction vector returned from the Deproject node seems to point “straight down”, which I suppose makes sense, which means that the corners end up projecting as you see in the image below (debug spheres drawn at the intersection with the invisible plane from the Line Plane Intersection node):

I suppose what I’d like is to be able to do the line plane intersection with a line running along the camera frustum, or “away from the camera” (not sure if frustum is the appropriate way to refer to this?). Or something. Does anyone know how I can achieve this? C++ suggestions welcome too; I’ll be converting this to C++ anyway.

To put it simply, I want the spheres to be at the corners of the actual viewport rather than as close to the player ship as they currently are.

Hey @Wayne_Koorts

in the character or pawn where your camera is located do something like this:

1 Like

Thank you so much! It turns out that the only thing I was actually doing wrong was not ADDING the world direction vector from the deprojection (x 10000 or whatever large number) to the start location. D’oh! I wouldn’t have realised that without your solution. Thanks again! Also TIL about the “Select float” nodes, that’s definitely more efficient than the way I was establishing the corner screen points.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.