# 2.5d side scroller camera bounds

**URL:** <https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188>\
**Category:** Cinematics & Media\
**Tags:** side-scroller, unreal-engine, question\
**Created:** [June 21, 2021, 9:39pm UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188 "2021-06-21T21:39:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hoihoisan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hoihoisan](https://forums.unrealengine.com/u/Hoihoisan)\
**Post date:** [June 21, 2021, 9:39pm UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188/1 "2021-06-21T21:39:36Z")

</div>

On the side scroller template, I’m running into the issue of setting up the camera to stop following the character along the Y axis when you’ve hit the edge of the map.

Things I’ve tried:  
Creating a camera blocking volume :

- When the camera hits the blocking volume, it just zooms the camera in really tight, overlapping the character.

Creating a custom collision box:

- disconnects the camera, updates a function by timer to update the camera location relative to the Z axis of the player, reconnects the camera when leaving the collision box. Super messy updating the location based on a timer and when it reconnects the camera, it “snaps” back into place in a jarring way.

I’ve searched google, unreal’s forums, answer hub, and I can’t seem to find anyone who has figured out a way to do it without removing the spring arm/camera and literally pairing the camera onto tick and manually checking to see if it’s within the bounds of an area.

Surely there’s a way to lock the camera’s location along the X/Y axis and allow Z movement at the edge of a map, like a metroid game, right?

---

<div class="post-metadata">

**Author:** ![L1z4rD89](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/l1z4rd89/32/1194537_2.png) [@L1z4rD89](https://forums.unrealengine.com/u/L1z4rD89)\
**Post date:** [June 21, 2021, 11:34pm UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188/2 "2021-06-21T23:34:44Z")

</div>

Hey, try this:

 ![342003-stop-cam.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/a/6baf9936066ee63e4388a411fc88fbd1043965a5.jpeg)

You can then replace F with a different event 🙂

---

<div class="post-metadata">

**Author:** ![Hoihoisan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hoihoisan](https://forums.unrealengine.com/u/Hoihoisan)\
**Post date:** [June 21, 2021, 11:44pm UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188/3 "2021-06-21T23:44:49Z")

</div>

That’s somewhat similar to what I did with the custom collision box, with the F event being the custom collision entering and existing the bounds. I didn’t like being forced to disconnect the camera and update it’s location on every tick… it seems like an extremely wasteful operation to perform.  
Do you know of a way to use the existing camera functions rather than disconnecting the camera from the player/swing arm and manually setting it’s location per tick?

---

<div class="post-metadata">

**Author:** ![L1z4rD89](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/l1z4rd89/32/1194537_2.png) [@L1z4rD89](https://forums.unrealengine.com/u/L1z4rD89)\
**Post date:** [June 22, 2021, 12:38am UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188/4 "2021-06-22T00:38:53Z")

</div>

Sry, I don’t know of any possible camera function to do that. But you can include your level bounds in your Movement if you want to:

 ![342004-level-bounds.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/c/a0c65004a4fe6d5967edb3f1a21259063115c402.jpeg)

---

<div class="post-metadata">

**Author:** ![Hoihoisan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hoihoisan](https://forums.unrealengine.com/u/Hoihoisan)\
**Post date:** [June 22, 2021, 1:16am UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188/5 "2021-06-22T01:16:57Z")

</div>

Oh! That worked! I modified it to use a boolean flag set by a collision instead of an absolute value check.  
I have a bounding box blueprint with a collision box in it. When the collision box begins the overlap, it sets the flag on the player to lock the camera. In the movement input, it has a check if the camera is locked… if it is, it sets the relative location of the camera to the location of the player minus a set value. Once the player leaves the bounding box, the bounding box trigger resets the relative location!

 ![342007-solution1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/4/0d4b37c73eac6c8bd780eb2b4bd216cfb78ebbc8.jpeg)

 ![342008-solution2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/f/3df2450a1f610934b3fb28ee5adc1437d1263efc.jpeg)

---

<div class="post-metadata">

**Author:** ![L1z4rD89](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/l1z4rd89/32/1194537_2.png) [@L1z4rD89](https://forums.unrealengine.com/u/L1z4rD89)\
**Post date:** [June 22, 2021, 1:22am UTC](https://forums.unrealengine.com/t/2-5d-side-scroller-camera-bounds/485188/6 "2021-06-22T01:22:30Z")

</div>

Glad to hear that and that I was able to help 🙂
