How to get the position of the next 'slot' in a container?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By perdanjam

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?

:bust_in_silhouette: Reply From: ld2studio

I don’t know if this video can help you

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.

perdanjam | 2022-03-12 08:36

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

ld2studio | 2022-03-12 09:43