You can use your own character for this tutorial provided it has a Camera component assigned to it. If you do not have a character, it is recommended that you complete the Working with Camera Components tutorial in order to create the basic character being used in this guide first.
In this How-to, we add a Spring Arm component and parent a Camera component to it so that our camera can expand/retract based on gameplay situations. Typically when you add a Camera component to a character for the purposes of creating a third person perspective, you will also want to include a Spring Arm to automatically control how the camera handles situations where the it becomes obstructed by level geometry or other objects in the level.
While it may not eliminate instances of the camera penetrating objects in your level, depending on your Spring Arm's settings, it will help reduce them by moving the camera's position when it becomes obstructed automatically and then returning to its default position when it is free from obstruction.
Continuing from the Working with Camera Components How-to, open your Character Blueprint.
In the Components window, click the Add Component button then select the Spring Arm Component.
Inside the Components window, drag your Camera Component onto the Spring Arm Component to attach it to the Spring Arm.
There are multiple settings that can be used with the Spring Arm which are outlined below.
This allows you to parent the Spring Arm to a Bone on a Skeletal Mesh or a Socket.
Here you can set the length of the Spring Arm when there are no collisions as well as set Offsets.
Set whether or not to check for collisions and define how big the query probe is to check for collisions.
Whether or not to inherit Pitch, Yaw, or Roll from the Parent or Use Pawn Control Rotation.
Set whether or not the camera should lag behind the target position and settings associated with lag.
We set the Target Arm Length to 100 and Enabled Camera lag.
This gives us a shorter length than the default settings and also adds a bit of lag to the camera when moving around.
Click Compile and Play to play in the editor.