Static player camera

This might seem similar to this question, but I already know of the Set View Target node. What I’m wondering is more of an architectural question as in how to design it and where to put things.

(I’m currently designing as much as possible in C++, but blueprint solutions are fine)

In short, I want every player to have a static camera that works like a basic RTS camera. In other words, it will move based on mouse input (when the mouse reaches the screen edge), not based on the character movement.

However, if I add the camera component into the player character, it has to go under the root node and will therefore be moved with the player character.

I could add a camera in the scene and use Set View Target to set the player’s view to that camera when the game starts, however that seems ugly and doesn’t scale well in a multiplayer game with an unknown amount of players.

So basically, where do I put the camera to set it up as one player’s personal static camera?

I figured out a way to do it which feels okay. Basically I have a separate camera actor that my playercontroller spawns at the beginning of the game.

For others looking to do the same thing: I wrote a new C++ class called APlayerCamera based on APawn and gave it a camera component as its root component.

Then in my PlayerController, I added an APlayerCamera variable and on Begin Play (important, you can’t do this in the constructor since you can’t set view target in the constructor) I spawn the camera actor, set up the start location of the camera and set the view to the spawned camera.