Is there a way to get the bounds / frustum coordinates of a scenecap2d at a given focal distance?
I’m not seeing a way of getting either 6 vectors for the frustum volume coordinates or 4 vectors for a plane at a given distance from camera. There’s “Draw Debug Frustum” BP node, but when I plug the transform of a camera into it just draws a square at the camera position, not a frustum / truncated pyramid.
Also, in the “show” menu I’m able to turn on “camera frustums”, but I only see this in-editor, not during play. I have both scenecap2d’s and cameras in the level and “ShowFlag.CameraFrustums 1” has no effect on either of them.
Would greatly appreciate any help you can provide. Hopefully there’s something that can be done in BP, I’m hoping to hold off on cpp until I finish my prototype.
Convert those viewport points into world space coordinates and use the direction vector to construct a line from the camera to some arbitrarily large distance.
Feed the camera position and an origin+normal plane in along with those frustum endpoints we just got to find the intersection of the plane with the Line Plane Intersection (Origin & Normals) node. I added optional debug draw functionality to this for visualization purposes (see final image).
And the resulting debug draw in-scene. Red is the line edges of the frustum, the orange dots are where they intersect the plane defined by my blueprint’s actor (a plane at the center of the frustum):
Disclaimer: No guarantees this works in all situations, I’m pretty new to Viewports, but it did the job in my case. If anyone has a better way I’ll happily adjust and re-post the answer. Also, I’m doing this in UE5 Early Access, just because that’s where I was playing around. Should work the same in UE4.x, though.