2.5d side scroller camera bounds

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?

Hey, try this:

You can then replace F with a different event :slight_smile:

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?

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:

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!

Glad to hear that and that I was able to help :slight_smile: