Okay, So I have a minimap which is being drawn from a Scene Capture Component 2D, and it captures the whole terrain. Problem is that capturing all the actors in terrain every tick causes the game to drop below 60 FPS, so my work around is to just render the terrain once on event begin play. Then draw an image widget that overlays on top of the static minimap. Afterwards, whenever the player moves, then update the player icon on the image widget to the new position. This would circumnavigate all the computation of the minimap for each and every tick.

So, here in lies my problem: I want to get the player location in the world, and then project that into the 2D coordinates that would be on my minimap.

I was trying to find a way to get the projection matrix that the scene capture component 2D uses, and then maybe try to use that to map 3D points in world space to the 2D points that I’m trying to compute. Does anyone have any suggestions? The Scene Capture Component 2D allows you to access a custom projection matrix, but I don’t want to define a custom projection matrix, I just want to grab the projection matrix that’s already being used by the Capture Component, and use that to get the coordinates I want.

I was facing the same issue, as I could not find any information about that I decided to try to calibrate the SceneCaptureComponent2D’s camera the same way I would do it for a real camera (with a chessboard etc) and it amees to work well.

The resulting camera matrix allows me to compute the 2D coordinates of an object based on the location of the object, the location of the camera and the rotation of the camera, it works fine for me. If that can help you the camera matrix I found for a 1920x1080 image is:

I don’t know how familiar you are with projection matrices, if you are not, here is a quick explanation on how to get the coordinates of the object you wish to project in the camera’s coordinate system:

.
Once you have that you just need to divide all the coordinates by the Z coordinate and then multiply the resulting vector by the camera matrix.

You can also apply the following formula before multiplying with the camera matrix if you want to remove the distortion of your images.

Where x’ and y’ is what you get after dividing by the Z coordinates. After that you just need to multiply the camera matrix with the vector (x’’, y’’, 1) and you should obtain the 2D coordinates of you object.