Working on 2d game.
I have a UI with a targeting reticle (a TextureRect node) on it's own canvas layer. I want the reticle to move to the player avatar if the reticle is not moved for a while, so I need the reticle to know the global_position of the player avatar. I do not understand how to translate the player position to coordinates the TextureRect can understand.
I already read the documentation for Canvas Layer, Canvas Item, and Viewports but I can't seem to make sense of it. I need someone to talk to me like I'm an idiot.
#This doesn't work at all but you can see what I'm trying.
var reticle
var playerCanvasPosition
onready var player = get_node("../../..")
func _process(delta):
playerCanvasPosition = player.get_global_transform().affine_inverse().xform(player.global_position)
reticle.rect_position = playerCanvasPosition