How to get or convert HUD coordinates to world coordinates ?

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

enter image description hereHi. Currently I’m doing a platformer game. However Im stuck on how to do an effect for example when the player collect a gem, it will instance a sprite node and will tween towards the gems UI (Label node). Please see picture.

HUD to world coordinates

rect_global_position will always return a same value. So I’m not sure how do I convert it to world coordinates ? Please help me. Thanks

:bust_in_silhouette: Reply From: Dlean Jeans

Maybe do it the other way around - reparent the coin to the HUD then convert world coordinates into screen coordiantes:

coin.global_position = get_global_transform_with_canvas().origin

Thanks man. This is what I want.

takhimi | 2019-07-22 07:56