Ui get_global_mouse_pos way off

Godot Version

v4.2.2.stable.official [15073afe3]


This code is in a ui element, Whenever I click it shoots the thing into the bottom right corner!

func _process(delta):
	if mouse_inside and Input.is_mouse_button_pressed(1):
		self.position = get_global_mouse_position()

Any clue?

assuming your UI element has its origin point on the top left this code will make your UI element go to the bottom right corner

Could it be because It’s in a grid?

I’m just trying to make a drag and drop for the inventory, y’know. for switching?

Final thing, It is actually becuase of the grid. Now I just dont know how to implement drag and drop properly lol. It lags too far behind and then stops dragging because of my crummy code

I GOT IT!!! Now I just need to figure out how to de-parent the node from the grid and re-parent it :person_shrugging: