How to create a fixed main camera through C++

Hey guys,

So, I’ve been browsing the unreal engine 4 documentation for hours tonight just to try and comprehend the camera workflow of the engine. Unfortunately, while it does make me feel stupid, I can’t seem to fathom the camera workflow AT ALL. The documentation seems so vague to me on many points.

Here’s the deal:

I’m attempting to create a very simple game. All it needs is a fixed camera looking down upon a scene where the player can then run around with a character. The camera and controllable character is not associated in any way. The only problem is, after having attempting for hours, I have no clue how you even make such a simple fixed camera just looking down on the scene through C++ coding. How do you go about doing this? Any kind of pointers would be wonderful.

I would like my level to have a fixed camera actor that’s just simply part of the level, and then upon game start, my C++ code should simply set that camera as the one it should view from. From what I’ve been able to understand it is the PlayerController that handles the current camera view? I attempted to use “SetViewTarget” with no luck.

So, I suppose what I’m asking is first and foremost how the “best practice” would be to set up such a fixed camera through C++ code. I need to see how this kind of workflow is done in Unreal, I’m completely lost even for such a seemingly simple task!

Thank you all for your help :slight_smile:

One hack would be to add a camera component to your pawn and make its transform absolute (relative is the default). That will make the camera fixed and it will not follow the pawn anymore.
Here is a similar question:

Thank you a lot for the suggestion :slight_smile: I will try this out, though it seems to be a completely reasonable way of doing it that should work. Thank you!

Let me know if you need any more help

Thank you :slight_smile: