The static distance with dead zone is one the easier dynamic camera for your side scroller game. Since we don’t have to worry about depth information, we can simplify a lot of the math.
In simple term you keep the camera from moving while the character is in the dead zone region and move the camera if they are outside of the dead zone region. For a side scrolling setup like this one, we only need to worry about single axis at a time.
The following diagram is a top down view of how things are placed in the 3d world. The yellow line represents the viewing cone (left and right edges of your screen).

Under this assumption, the camera remains stationary when the player is within the dead zone and follows the player when they move outside it. Because the playing plane and camera plane are parallel, camera movement matches the character's movement one-to-one. For example, if the character moves 5 units outside the dead zone, the camera moves 5 units to maintain them within the dead zone.

To calculate the character's distance from the camera, we perform a simple subtraction since both planes are parallel: character.x - camera.x
Using this distance, we can calculate how far to move the camera to position the character at the dead zone's edge: distance.x - threshold.x
Finally, we apply this calculated value as needed.
The following formula shows how to update the camera's X position to keep the character in view, presented in both standard and simplified forms:
new_camera_x = camera.x + ((character.x - camera.x) - threshold)
if (character.x - camera.x) - threshold > 0:
camera.x = new_camera_x
# With some simple algebra, we can simplify to this.
new_camera_x = character.x - threshold
if character.x - threshold > camera.x:
camera.x = new_camera_x
We need a similar calculation for the left side of the screen:
new_camera_x = camera.x + ((character.x - camera.x) + threshold)
if (character.x - camera.x) + threshold < 0:
camera.x = new_camera_x
# And the simplified form.
new_camera_x = character.x + threshold
if character.x + threshold < camera.x:
camera.x = new_camera_x
Since the dead zone should not overlap, these calculations can run independently.
Lets implement the new camera component class by extending BP_CameraComponent. Which we defined here.