DEVIL MAY CRY / RESIDENT EVIL CAMERA SYSTEM IN UNREAL ENGINE


Today, we are going to be making a camera system in the style of such Capcom titles as Resident Evil and Devil May Cry.


To begin, we are going to create a Blueprint interface for our player character. We are creating this so we have an easy, agnostic communication line to our player. To gain an in-depth view, please visit HERE to learn about them by veteran tutor Mathew Wadstein. For now, the basic gist is a Blueprint Interface is an interface between blueprints.

When Blueprints communicate with each other, if we are not explicitly told ahead of time, we don’t know who or what that Blueprint is. A Blueprint Interface allows us to say “Hey if you are Mr X, fire this event that Mr X knows”.

We will not be using the Blueprint Interface to its fullest capacity today. for now, we will simply be using to know if the person we are talking to is Mr.X.

However, this is a good practice as opposed to tags as later down the line, other blueprints can communicate with Mr.X and fire specific events. It is important to future proof your designs so you can save time and sanity later down the line.

To create a Blueprint Interface, right-click in your content browser, select the “Blueprints…” section and then select “Blueprint Interface”. Call this something you’ll remember. As an example, I have called mine “BPI_3DPlayer”.

We now need to attach this to our player. Open your player Blueprint and use the top ribbon to go to the “Class Settings”.

Under the “Implemented Interfaces” section, press “Add” and select your Blueprint Interface.

Save and Compile this Blueprint and you can now close it.


Time to create the camera system itself. We need a Blueprint for this, so right click the content browser and select “Create Blueprint Class”.

For our needs, we could select an Actor blueprint. However, we will be creating a camera as the root of our Blueprint so we might as well inherit from the CameraActor base class. Within the search area for “All classes”, type in “Camera” and select the “CameraActor” to create a Blueprint that inherits from “CameraActor”.

You can call this created Blueprint whatever you want, as an example, I have called mine “CA_ResiCam”.


When you think of a Resident Evil / Devil May Cry camera system, you need to take into account the distinct types of camera. Some have only one “entry/exit” point, wheres most have two (depending on map design).

Because of this, we are going to design our system to be able to use two entry/exit points but offer the flexibility of also being able to use only one. This gives us the most freedom in reusing our Blueprint, which is an important factor when creating components in software development.

We are going to need three variables. We are going to need a boolean that asks “Are we using Two Entry / Exit points?”. We are then going to create two more variables, this time Transform variables. This is to let us know where in world space our entry/exit points are, how big they are and what rotation they are using.

We need to add some default values to make this system a bit easier to use out of the box. Here are the values to use:

UsingTwo (Bool) = FALSE;
VolumeTransform1 (Transform) = Location: x10, y0, z0 // Rotation: x0, y0, z0 // Scale: x1, y1, z1;
VolumeTransform2 (Transform) = Location: x10, y-100, z0 // Rotation:  x0, y0, z0 // Scale: x1, y1, z1;

You can alter these values by compiling the Blueprint then selecting them in the variable. Go ahead and set these now.

We have almost finished with these variables. With the two transforms, we want to manipulate these values in the editor, so we can adjust our volumes according to our needs. This gives us a more visual system for putting our camera system together.

Select the two Transform variables one by one and within the Variable Details, select “Instance Editable” to true as well as “Show 3D Widget”. This will allow us to set these values within the editor viewport.

We are almost ready to put these variables to good use. First, we need to create our “Entry points”. To do this, go to the “Components” and select “Add Component”. Type in “Box Collision” and create a Box Collider. Do this twice, so you have two of them.

Select each one and in the “Variable Name” category, give them a memorable name. In my example, I have named the first one “Entry” and the second one “Entry2”.


We need to add some code to these two colliders that fires in the editor, especially when we move our transform values. To do this, we use the “Construction script”, which is a function that fires every time this Blueprint is altered, moved or used within Unreal Engine 4.

Use the “Construction Script” tab to use this function.

The general overview for this function is Entry > Set Relative Transform of Entry 1 to the VolumeTransform1 variable. Then, check if we’re “Using two?”. If so, set the relative transform of Entry 2 to our VolumeTransform2 variable. Else, reset the VolumeTransform2 variable and then Set the Relative Transform.


Now is the time to add the in-game functionality of this Blueprint. Press the “Event Graph” tab to enter the Event Graph.

Go to the “Components” section and right click Entry1. Select “Add Event” and then select “Component Begin Overlap”. This will create a Begin Overlap event that will fire when something overlaps our Entry box collider. Do the same for Entry 2.

Now, from the “Other Actor” output of this node, click the out and drag to an empty space of the Blueprint. When the Context-Sensitive window opens, type in “Interface” and select “Does Implement Interface”.

When the node is created, click the “Interface” button and select the Interface that we created and attached to the player. Create a “Branch node” and use the output of the “Does Implement Interface” node. Do this for both overlap events.

For the Entry2 Overlap event, bring in the “using two?” boolean and then add an “AND” variable. This is because this should only accept collisions if we’re using the two collision mode.


From here, we need to add what happens if either of these branches is = to true. Grab the Player Controller with “Get Player Controller” and from the output pin, search for “View Target” – selecting “Set View Target with Blend”. The new target is “Self” – which means this Blueprint (or more specifically this camera).

This will change the camera to this camera.


We’re pretty much there but there is one final thing we need to take into account. The template 3D characters in Unreal Engine use the Control Rotation to decide what is forward and what is backwards. We need to override this control rotation with the current camera’s rotation, so when this camera is active, pressing forward is going to move away from this camera and not the last camera. Think of older games where you’d hold forward as youswitch cameras, when you did this you’d constantly run in a circle as you flipped between the two cameras angles using the same, conflicting input directions.

To do this, get the Player Controller once again and look for “Set Control Rotation”. For the rotation value, get the camera component and get the world rotation of the component.


What we’re going to do here is add a Custom Event that overrides the branches, just so we have the power to set this as the active camera at the end of a sequencer or at the start of the game.


And we’re done. Simply place a few of these Blueprints in your scene (give them a little space in between each other so the colliders don’t fight each other) and use the 3D widgets to set them up as you want them and you have a working Resident Evil / Devil May Cry / 3D Capcom-style camera system.