Back to Content

Creating a Third Person Camera - Tutorial

This tutorial shows how to create a third person camera controller, a camera following an animated character moving through the world using Coppercube.

Start - create your 3D scene

To start, we need a 3D scene where we can walk through. Import a 3D Model, add a skybox, lights and whatever you want until you like the 3D scene. In this tutorial, I've used the room generator, to create a simple room which looks like this:

A scene for this example

You can use the room generator built into CopperCube by selecting the Menu Command 'Edit -> Insert -> Create a room mesh from a 2D map' and paint a simple room.

Adding an animated character

Once you have set up your scene, we need a animated character which we want to be followed by the third person camera. In this tutorial, we use the 'Clerk' from the prefab window: Simply double-click the clerk icon in the prefab window and place the animated model into your scene:

The animated character for our scene

In order to make this character move when we press buttons on the keyboard, we need to add a behavior to it. Select the clerk, go its 'Behaviors' window and add a 'Object or Person controlled by keyboard':

Adding the 'Object or Person controlled by keyboard' behavior

If you like, adjust the 'MoveSpeed' property of that object to a bit slower value, like to 0.02 to make the clerk move a little bit more realistically. Also, if you don't want him to be able to walk through walls, add a 'Collide when moved' behavior to him. If you do that, be sure to adjust the yellow ellipsoid to surround him, and that the ellipsoid is not stuck in the wall or in the floor.

Note: Of course you are not forced to use an animated character like the clerk for the model you want to control and follow using the third person camera. You can also use any other, even not animated 3D object for that.

Adding the Camera

Once you have set up the scene and the animated character, to the important part: We need the third person camera. Click on the 'Scene editing' tab and click the camera symbol to create the new camera (Alternatively, use the menu: Edit -> Insert -> Create a Camera).
A dialog like this should appear:

The camera creation dialog

Select the 'Third Person Camera'. This creates a new camera and selects it. Also, you will be asked to select the object it should follow. Select the clerk object for this. In the 3D scene, move the camera behind the clerk, in the distance and angle you want it to follow the character:

Third person camera placed behind the character

You can now also adjust some of the values, like the FollowMode, the Smoothingspeed and if the camera should be able to go through walls or not (CollideWithWorld). See details of these settings in the Behavior description page, under '3rd Person Camera Style controlled'.

And basically, that's it, now you can walk around with your 3D character, which is being followed by the camera. You can test your application now (menu: Tools -> Test as Windows .exe or Flash .swf).