The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I want to add camera borders for my game but I don't know how to do or is it possible to do. I think I can make it work using 'if's and checking camera position but it would be too long

Godot version 3.3
in Engine by (81 points)

Oh, do you mean like a 'recording screen' where the camera has the red recording dot and battery percentage?

Sometimes it may take a few hours for a person who knows about the subject and can comprehend your question to give you a good answer, when you repost the question it won't necessarily be answered faster but it will push other questions down which is why the site gives you that warning.

3 Answers

0 votes

you have accidentally posted the question twice, so maybe delete (or hide) the old one, and that's why it was giving you a 'duplicate error'

as for the 'camera border', you can put an image in the 2d screen (as a sprite or something), and it will be displayed on top of the 3d scene.

by (248 points)
0 votes

globalposition.x = clamp(globalposition.x, MINX, MAXX)
globalposition.y = clamp(globalposition.y, MINY, MAXY)

by (18 points)
0 votes

you could add mathemathical "clamp" for the camera the camera position or you could add an collider to the camera/or the player and make a wall arround the level.

Look here:

by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.