Moving the center of a sprite to mouse

This is a noob question but how do I move the center of a sprite to my mouse, currently I am using

position = get_viewport().get_mouse_position();

but this aligns the mouse to the top left of the sprite, and if I change the pivot point to the center of the sprite, the sprite then goes even further right and below where the mouse is. I know that I could easily just manually add to the x y values to get the result I want but I still want to know why this is happening to make things easier in the future.

Set the pivot position of sprite to the half of its size not full.

Put the sprite inside a CenterContainer and then set the position of the container to be that of the mouse. If this doesnt work then your CenterContainer should have a use_top_left property that you need to enable

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.