Using Spring Arm Components

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.

springArm1.png

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.

  1. Continuing from the Working with Camera Components How-to, open your Character Blueprint.

  2. In the Components window, click the Add Component button then select the Spring Arm Component.

    Spring1.png

  3. Inside the Components window, drag your Camera Component onto the Spring Arm Component to attach it to the Spring Arm.

    Spring2.png

  4. There are multiple settings that can be used with the Spring Arm which are outlined below.

    Spring4.png

    Section Description
    Sockets This allows you to parent the Spring Arm to a Bone on a Skeletal Mesh or a Socket.
    Camera Here you can set the length of the Spring Arm when there are no collisions as well as set Offsets.
    Camera Collision Set whether or not to check for collisions and define how big the query probe is to check for collisions.
    Camera Settings Whether or not to inherit Pitch, Yaw, or Roll from the Parent or Use Pawn Control Rotation.
    Lag Set whether or not the camera should lag behind the target position and settings associated with lag.
  5. We set the Target Arm Length to 100 and Enabled Camera lag.

    spring3.png

    This gives us a shorter length than the default settings and also adds a bit of lag to the camera when moving around.

  6. Click Compile and Play to play in the editor.

End Result

When moving the character, you will notice that the camera now lags slightly behind the characters movement. Also, when we move near a wall and rotate the camera, it attempts to reposition itself and moves in closer. When we are free from obstruction, it returns to its default length that we have specified in the settings.