Skip to main content

Third Person Character

It is possible to use the UC as a point of view for a Third Person Character.

Having your Character class and the UC as two separate entities isn't really an issue and, in fact, can give some benefits.

Think of it as for a RTS game: you can control both the camera movement and the units on the ground based on your inputs, even though you're not directly possessing these units.

For a third person setup, it is the same: you can possess the camera while redirecting some inputs to your Character.

One of the benefits of directly possessing the UC over the Character is that it can outlive your Character.
In a MOBA, for example, you might want to keep controlling the camera while your Character is dead.

Possessing the Character

If you know the camera will always be tied to the Character no matter what, you may want to simply possess the Character and spawn the UC from it, as if it were a simple component. When the Character is destroyed, you'll probably want to also destroy the UC.

Spawn the UC, make it follow my Character and SetViewTargetWithBlend():

Move my Character using the UC's rotation:

Rotate the UC by redirecting inputs from my Character:

Possessing the UC

Possessing the UC and redirecting relevant inputs to the Character will allow you to outlive the Character with the UC, and more easily move around while it is unavailable, or even switch between different Characters.

First, make sure your Character is possessed by AI.

From the UC BP:
We can take control of a Character by following it and storing a reference to it:

We can simply Rotate the UC using our Inputs:

And move the Character depending on the UC Rotation:

note

Notice that, in this setup, if the Controlled Character is not valid, we'll be moving the UC instead.

Following with an Offset

You can use the Offset of the UC to place the camera exactly where you want it.

Rotating the Character

If you want the Character to face where the camera is looking, you can update its rotation whenever you modify the rotation of the UC.

In this example, I'm rotating both the UC and the Character using the mouse. See Rotating with the mouse.