0 votes

I am trying to make a top down shooter where the player faces the mouse cursor.
while searching on net i found look_at() suitable for rotation but when I apply it to my script it doesn't work as desired.
The code is-

look_at(get_local_mouse_position())

The code is in physicsprocess(delta).
Video showing error

in Engine by (30 points)

have you tried with look_at(get_global_mouse_position()) instead?

Thanks it worked.

no problem! you may select your own answer so others can see its solved.

1 Answer

0 votes

As p7f said in comment it works withlook_at(get_global_mouse_location()).
Once again thanks p7f

by (30 points)
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 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 webmaster@godotengine.org with your username.