Stop camera moving out of game bounds (TopDown)

So I’m making a topdown game split by rooms (similar view style to binding of isaac kinda?) like this image

imagine the camera is more zoomed in following the player so you can’t see the whole room while playing, what I want is if for example the player moves to the top right and the camera is going to show outside the red line that it would stop moving and only move again if the player moves downwards. So you’re only able to see inside the room and not the surroundings.

There are already invisible walls (box collisions) where the brick texture is surrounding the room and the camera is already attached on a spring arm, could you expand a bit on the answer?

You could create invisible walls & attach your camera to a spring arm, which will handle collisions.

Check out the third person template. It’s setup there :slight_smile:

hmm…maybe your collision settings on the invisible wall aren’t blocking cameras?

sorry for dumb question…but are you sure the invisible wall is high enough? seems like you’ve got the right setup…

I’m already using the third person template just to test stuff, there isn’t really anything set up and the settings on the thirdpersoncharacter’s camera and camera boom are the same as mine.

They are set all set on BlockAll.

Yep I just set them all to x100 (which goes way up in the sky) to test and it’s the same. Maybe I need to do something up on the springarm settings or somewhere else?

Doesn’t look like it and if I turn it too high my character turns invisible when I’m not moving.

yeah, my guess is there’s some setting on the spring arm that needs updating. maybe the size of the collision probe for the camera?

hrmm…i think i’m out of ideas :’(

I’ve found a dozen similar questions on other websites and everyone says just to put a volume that blocks cameras which doesn’t work for me for some reason… would posting images of my camera+spring arm+collision help?

I have same issue on a 2d side scoller, like yourself searched for the answer and camera blocking voluming is just not working hope ive missed something simple please someone help!!!

I semi-found a solution but that brings me into 2 problems. I used 4 collision boxes surrounding the room. If the player gets inside the top/bottom or left/right ones it locks the camera on the respective axis and if he’s inside both it locks both axis.

The problems are most importantly that when the resolution changes then you may see outside the room or not even the whole room and secondly when I teleport to a new room the camera is on the player so you can see outside the room.

maybe you forget to enable “Do Collision Test” in the spring arm settings!