How to place actor at edge of screen using BP?

I have an orthographic camera in a fixed positions and objects move in and out its view. I want to add some actors at the edges of the screen but I don’t know how to get the world location for the positions. Is there any way to get frustum planes for a camera, similar to Unity’s [GeometryUtility.CalculateFrustumPlanes][1] or another utility that gives me world coordinates for edges of the viewport?

Here’s the camera setup, I’m thinking that if I can access the top, left, bottom and right planes of the camera frustum I can get the locations I need to spawn the actors, but I haven’t figured out how to get the planes.

I’m not sure of the exact procedure, but some pseudocode would be:

  1. Find the camera Viewport (You can do this with a UMG system, probably)
  2. Get the corner of the Viewport (Should be simple after finding it)
  3. Set actor location to those coordinates (The only hard part should be the forward vector, you could customize it with a public editable variable)

I created a custom blueprint node for that returns the world coordinates for the centers of the top, left, bottom and right frustum planes.

To test it I’ve made it so that at game start a fire particle is initiated at the center of each of the planes. The cube represents the camera position.

http://i.stack.imgur.com/x0BxC.png

http://i.stack.imgur.com/eDwQi.png

Blueprint usage

http://i.stack.imgur.com/5wH6X.png

CameraUtils.h

#pragma once

#include "Camera/CameraActor.h"
#include "CameraUtils.generated.h"

/**
 * 
 */
UCLASS()
class PROJECTNAME_API ACameraUtils : public ACameraActor
{
	GENERATED_BODY()
	

public:
	
	UFUNCTION(BlueprintPure,
		meta = (
			DisplayName = "Get Camera Edges from Frustum",
			Keywords = "Camera Edges Frustum"
			),
		Category = "Camera|Utility")
		static void GetCameraFrustumEdges(UCameraComponent* camera, FVector& topCenter, FVector& leftCenter, FVector& bottomCenter, FVector& rightCenter);
	
	
};

CameraUtils.cpp

#include "ProjectName.h"
#include "CameraUtils.h"


void ACameraUtils::GetCameraFrustumEdges(UCameraComponent* camera, FVector& topCenter, FVector& leftCenter, FVector& bottomCenter, FVector& rightCenter)
{
	// Assumptions: Camera is orthographic, Z axis is upwards, Y axis is right, X is forward

	FMinimalViewInfo cameraView;
	camera->GetCameraView(0.0f, cameraView);
	
	float width = cameraView.OrthoWidth;
	float height = width / cameraView.AspectRatio;
	
	topCenter.Set(cameraView.Location.X,
			      cameraView.Location.Y,
			      cameraView.Location.Z + height/2.0f);

	bottomCenter.Set(cameraView.Location.X,
			         cameraView.Location.Y,
			         cameraView.Location.Z - height / 2.0f);

	leftCenter.Set(cameraView.Location.X,
	 	    	   cameraView.Location.Y - width / 2.0f,
			       cameraView.Location.Z);

	rightCenter.Set(cameraView.Location.X,
			        cameraView.Location.Y + width / 2.0f,
			        cameraView.Location.Z);
		
}