I have the following UI with playing cards being dealt as shown by the red arrow:
I’m trying to make them be dealt relative to the “Deal” button towards the center of the screen. So I have something like this on button click:
var pos1 = deal_btn.rect_position + Vector2(-200, 0)
card.rect_position, pos1, 0.5,
The deck (which is the green square), is giving me a position of
(0,0), whereas the
deal_btn is giving me a reasonable value of
819.200012, 512 and
pos1 is being calculated relative to it at
The problem seems to be with
deck being at
card is added as it’s child and is also at
(0,0)... so I’m animating from
(619.200012, 512) - off screen!
deck is a child of a control node… maybe that’s the reason? (as child nodes of control nodes don’t get to decide their position). See same link above - 2nd image for scene tree.
How can I get the “absolute” position of the deck in the screen (not relative to where the control node decides to put deck)? I assume I can then use this to do some vector math and get the right position.
(Added screenshot of Deck's parent's anchors).