MainCamera would have been a better choice.ĭefaultCamera is a simple blueprint I created to program the logic of the camera movement. My apologies for picking a tag name that is also the name of the blueprint.
Looping through all the actors of type DefaultCamera may seem overkill but it allows me to re-use the class but have only one be the main or default one. We then call Set View Target with Blend to "aim" the camera at the player.
In the GameMode blueprint event BeginPlay we loop through all the actors or type DefaultCamera and look for the one also tagged DefaultCamera and store a reference to it. Keep in mind that this is just one way to go about it. Here is how I went about getting it done. If you think about it, if the camera is attached to the character as a component, once the character is destroyed so is the camera. I also wanted to have full control of the behavior of the camera and I did not want to worry about the camera after the character was destroyed.
In this Unreal Engine 4 tutorial I will talk about how to change the "default camera".įor one of my projects (A 2D side scroller) I wanted to have a camera actor as opposed to a camera component attached to a player character, like in some of the engine sample projects.