0 votes

I want to be able to stop the camera scrolling in different places in different parts of the level. My idea for how to implement this is to overlay an Area2D over the camera viewport and use Area2D's for where i don't want the camera to enter. When they collide, get the side it collided on and set the proper limit attribute to the camera's X or Y position. But this seems janky and slow to me, and i feel like there is a better solution. But i can't come up with anything. What do you think?

in Engine by (243 points)

1 Answer

0 votes

Try if $Camera2D.distance_to(#anArea.position) < #desiredDistance: then stop camera movement.

by (325 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 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 webmaster@godotengine.org with your username.