how to set popup position?

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

i try to change position to position i want, but didn’t work.
i want it at middle position2D
here video to my problem

here my code

func _on_tower_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
	if event is InputEventMouseButton:
		if event.is_pressed():
			print("click shop")
			$testPopup.rect_global_position = $pop_pos.global_position
:bust_in_silhouette: Reply From: payload505

see this video might help

:bust_in_silhouette: Reply From: jgodfrey

I think you want this:

$testPopup.rect_position = $pop_pos.position

i get right position for both in print() , but even i change pivot_offset, it still use 0,0 pivot_offset, like in the video show.

i want it popup at middle Position2D
why this happend?
how should i fix it?

enter image description here

here my code $testPopup.rect_position = $pop_pos.position
my popup at (0,0)

enter image description here

enter image description here

potatobanana | 2020-03-17 05:07