Problem with minimap code in Godot Engine 3.5

Godot Version

Godot Engine 3.5


Hello, I hope you are very well, I need you to guide me with what I am going to tell you, I had a problem with my game created in Godot Engine 3.5, the problem is that in the minimap that I have created only the position of the player is shown correctly, but the position of another sprite that I have created is not shown correctly in the map, it always throws it in the position 0,0 or in a position not linked to the sprite that I indicate that it should follow, here is my code for you to give your opinion and tell me what I can do about it, thank you very much!

extends CanvasLayer

var player: KinematicBody2D
var planet: StaticBody2D

func _ready():
	player = get_tree().get_nodes_in_group("player")[0]
	planet = get_tree().get_nodes_in_group("planet")[0]
	$Map/Viewport/Sprite.global_transform.origin.x = planet.global_transform.origin.x
	$Map/Viewport/Sprite.global_transform.origin.y = planet.global_transform.origin.y
func _process(_delta):
	$Map/Viewport/Sprite2.global_transform.origin.x = player.global_transform.origin.x
	$Map/Viewport/Sprite2.global_transform.origin.y = player.global_transform.origin.y

Just in case, the code I am talking about is in the function _ready()

If you’re moving the planet, the sprite position won’t update because it’s only set once in ready and not constantly in process like the player.

I did that before, but it still did not show the correct location in the viewport.