Node isn't rotating towards mouse?

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

I am trying to get an Area2D to rotate towards the mouse. Instead of rotating towards the mouse, it splits into two (both are, i think, 50% transparent) and rotates in two different directions instead of just rotating towards the mouse. If I use get_viewport().get_mouse_position() or get_global_mouse_position() instead of get_local_mouse_position(), it rotates when the mouse moves, but not towards the mouse, and not as fast as the mouse moves.
Here is the related code:

var mpos

func _process(delta):
	var mpos = get_local_mouse_position()
	rotation = mpos.angle()

Could someone please help me?

:bust_in_silhouette: Reply From: Dlean Jeans

Use the built-in function look_at:

look_at(get_global_mouse_position())