Using Spring Arm Components

The Spring Arm component is used to automatically control how the camera handles situations where it becomes obstructed.

Choose your operating system:

Windows

macOS

Linux

Choose your implementation method:

Blueprints

C++

[INCLUDE:InteractiveExperiences/UsingCameras/SpringArmComponents/SpringArm-BP#springarm_BP_1]
[INCLUDE:InteractiveExperiences/UsingCameras/SpringArmComponents/SpringArm-CPP#springarm_CPP_1]

![Spring Arm in action](SpringArm_shared1.gif)

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 first complete the Working with Camera Components tutorial in order to create the basic character being used in this guide.

While it may not eliminate all instances of the camera penetrating objects in your level, depending on your Spring Arm's settings, it will help reduce them by automatically moving the camera's position when it becomes obstructed and then returning to its default position when it is free from obstruction.

Creating the Spring Arm Component

[INCLUDE:InteractiveExperiences/UsingCameras/SpringArmComponents/SpringArm-BP#springarm_BP_2]
[INCLUDE:InteractiveExperiences/UsingCameras/SpringArmComponents/SpringArm-CPP#springarm_CPP_2]

Setting up Character Input

[INCLUDE:InteractiveExperiences/UsingCameras/SpringArmComponents/SpringArm-BP#springarm_BP_3]
[INCLUDE:InteractiveExperiences/UsingCameras/SpringArmComponents/SpringArm-CPP#springarm_CPP_3]

Level Setup

To demonstrate the functionality of the Spring Arm Component, you will need to place some geometrical obstructions into your level.

  1. In the Editor , navigate to Window > Place Actors to open the Place Actors panel.

  2. In the Place Actors panel, select the Geometry tab, and drag a Box Brush into your level.

    Click image to enlarge

  3. In the Details panel, you can adjust the bounds of your Box Brush by navigating to the Brush Settings category, and adjusting the X , Y , and Z values.

    Click image to enlarge

  4. Next, from the Toolbar press PIE(Play In Editor) .

    ![Toolbar Play In Editor](SpringArm_shared12.png)(w:800)

End Result

![Spring Arm demonstration](SpringArm_shared13.gif)

When using WASD to move the character, you will notice that the camera now lags slightly behind the character's movement. Also, when you navigate your character near a wall, the camera attempts to reposition itself and moves in closer. When the character is free from obstruction, the Spring Arm returns the camera to its default Target Arm Length that is specified in its default class properties.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss