StaticBody2D position = mouse position

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

How do I make my static body 2d’ position equal to the mouse position through gdscript?

:bust_in_silhouette: Reply From: Gluon

You should be able to use the following lines of code to achieve that.

var mouse_pos = get_global_mouse_position()

$StaticBodyName.position = mouse_pos

but a static body shouldnt be moved around really. You should have a different node for that really