0 votes

Is there a way to get the Vector2 position of the next available 'slot' in a container?

I'm moving a control node between 2 containers, but tweening its rect_position first.

I want to tween it into the second container, so I'd like to know that postion ahead of time.

Is that possible?

Alternatively if I could just make the node's rect_position transition whenever it moves (like CSS transitions), I wouldn't need to run the tween beforehand to create this illusion?

in Engine by (12 points)

1 Answer

0 votes
by (56 points)

Interesting videos, they may come in handy later.
In the end what I did was:
Use an empty Control node as a 'front runner' and put that in the destination first.
Then use the front runner's position as the the tween destination.

It's not ideal because I have to keep re-organising my tree, but it works.

Another thing I needed to do was yield(get_tree().create_timer(0.001), "timeout") before starting the tween, because the front runner's positon wasn't updated in time.

I'm glad to know that the video was able to help you

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.