Hey Everyone! I wanted to share with you all a tutorial on how I go about doing multiple camera angles at the moment and to have these be controlled from within the class Blueprint instead of the Level Blueprint. I couldn’t do it by simply just using a CameraComponent within the class Blueprints’s Components Window and I am not sure if there is a much better way to do this but this was something I uncovered while trying to achieve this for myself. If any of you know how to make this better, feel free to chime in.
I hope this helps you all that are trying or interested in doing this so let’s get started
Setting Up Our Pawn Blueprint:
We are going to use the Rolling Template for this example so feel free to follow along if you want. If you do, start a new Rolling Blueprint project and we should end up here.
Let’s double click the PhysicsBallBP under the Blueprints folder in your Content Browser and open it up to modify.
Instead of using the CameraComponent already created for us…
Let’s replace it with a ChildActorComponent instead and name it “3rd Person Camera” and also rename our SpringArmComponent to “3rd Person Boom”. You’ll see next why we are using the ChildActorComponent instead of the CameraComponent here once we get onto the Blueprint Graph.
Once you’ve done this, we’re ready to move onto the next step.
Setting Up Our ChildActorComponents:
The next thing we are going to do is the same process over again for a couple more ChildActorComponents that will represent our other Camera’s that we will switch between. Let’s start by creating an additional First Person Camera and setting it’s SpringArm Target Arm Length and Transform to the following…
After this step, let’s go ahead and create a Top-Down Camera as well… after you follow the same steps, your’s will look like this…
The last thing we want to do here before we goto our Graph is select each one of your ChildActorComponents holding down the Ctrl Key and clicking all of them. After that, simply set the Child Actor Class combo box to CameraActor.
Before we continue to the Graph, Save and Compile your Blueprint.
Creating Our Blueprint Graph:
Now normally, the Blueprint will just default to the first camera it finds but let’s start off by specifying that we want to use the 3rd Person Camera as our starting point. Before we create the additional nodes to the Graph, create two Private Variables of Type Byte and call them CameraIndex (Default = 0) and CameraCount (Default = 3).
Here is the Graph to default our camera to the 3rd Person Camera upon startup. Note that I added an additional exec to set whether or not to constrain the aspect ratio of the camera. This is more or less to demonstrate how you could change properties on the camera. You could event opt in to setup all of your camera properties off of the Event Begin Play if you wanted.
And the last step is to hook up the functionality to switch between the different cameras
And that’s it, you now have a Pawn with a basic camera system setup! The First Person Camera is actually pretty nuts and disorienting so don’t go grabbing your Oculus Rift unless you wanna hit the ground but have fun everyone and I hope you all enjoyed this tutorial and I hope it was helpful for you in some way. This is my first UE4 tutorial and I decided to put in some time putting this together in midst of making my next game but I saw a couple people ask and thought it would be a fun one to share and help people out with.
Take Care And Game On