0 votes

Is there a way to set the min position and max position of the control node?

I have a "Control" node. And I want to keep it between the "0, 0" and "750, 250" positions. So I can drag this node and I want not to move it out of these positions. So I don't want to let him go out of those positions.

Godot version v3.4.4.stable.official [419e713a2]
in Engine by (95 points)

1 Answer

0 votes
Best answer

Ok, I solved the problem. I did it by typing "rect_position" as "clamp()".
rect_position.x = clamp(get_global_mouse_position.x, 0, 750) and rect_position.y = clamp(get_global_mouse_position.y, 0, 250)

by (95 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.