Get position of all children inside node relative to viewport

NorthProse11NorthProse11 Posts: 4Member
edited July 2017 in Programming

Let's say i do something like:

func get_nodes_in_line(pos):
    for node in node_container.get_children():
        if node.get_pos() == pos:
            for child in node.get_children():

What i see is the child node's position relative to it's parent node. What is the best way to get the positions of all child nodes relative to the viewport?

Thanks in advance


  • vnenvnen Posts: 31Admin Godot Developer

    Why not just child.get_global_pos()? Should return the global position. But if you want the position on screen and you are using some Camera, you need to do some math with the canvas transform.

Sign In or Register to comment.