I need help making a limit to my camera

Godot Version

Godot 4

Limit to camera

Hello, i am currently starting out developing on my game, and i have run into a problem. I want to limit the place my camera can go, because when panning, it can go further than the area intended to pan. I have no idea how to add a limit to where the camera can look at. Can someone please explain whats going on or what i can do so I dont have to expand the sprites?

Since you didn’t specify, with a 2D camera you can simply set it’s “Limit” properties, and the camera won’t be able to move past those points.

1 Like

You can also write code to feed it a TileMapLayer and have it convert that to a rectangle based on the tiles you used. If you want that code I can find it in my projects.

Thank you for telling me possible solutions. I have went with the one tibaverus reccomended, now it doesn’t pan off into the grey void of nothingness. Regardless, thank you all!

2 Likes