+1 vote

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

Godot version 3.4.2.stable
in Engine by (13 points)

1 Answer

0 votes

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

by (2,155 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.