0 votes

How can i compute the Rect2D that i've drawn in?
enter image description here

in Engine by (107 points)

1 Answer

0 votes

You would need to draw 4 lines
https://docs.godotengine.org/en/3.0/classes/class_line2d.html?highlight=Line

Add them as child of the same parent so you can use this parent as reference to the points.

by (521 points)

Thank you for your answer but the issue i have is not the drawing of lines but the size of the parent.
I want to build a convoy of ships and want to test if the whole convoy has left the screen.
I also want to be able to programatically fill the convoy with ships and do not want to edit every convoys "size box" by hand.

If i could figure out a way to get the size (a Rect2D that encloses all child elements) i could solve my issue with code in process() or with a VisabilityNotifier() but for both i need the size.

In the past i've solved this kind of thing with get_rect() but this seems to be gone now.

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.