#Getting the vboxcontainer child.global_position

3 messages · Page 1 of 1 (latest)

jaunty peak
#

I'm trying to get the global positions of the child nodes in a vboxcontainer in script. So far I've tried having them emit their global position after being instantiated (ready) and calculating their positions based on an index (The container rect_size doesn't update after the children are instantiated.)

#

get_combined_minimum_size() worked to get the container-size post instantiation, but it's a lot of code that could be omitted. Is there another way?

surreal steeple
#

You could try awaiting a frame (await get_tree().process_frame) during the children's _ready to wait for the layout to position it's children, and then try to get it's global position:

func _ready():
    await get_tree().process_frame
    emit(attributes, global_position)