Player not looking at mouse when using a camera2D

4.2.2

i have a top-down player and i added a weapon that looks at the mouse but when i added a camera2D that follows the player, the weapon just looks toward (0,0) i think.

i tried
look_at(get_viewport().get_mouse_position())
look_at(get_global_mouse_position())
look_at(get_local_mouse_position())

I found the solution:
look_at(get_global_mouse_position() - global_position.normalized())

Hows your scene build up? maybe try this:

look_at(camera.global_position + camera.get_local_mouse_position())

Didn’t work sadly, but I’ll check the source of a game and right the solution here

Solution:

look_at(get_global_mouse_position() - global_position.normalized())
1 Like

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