Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dpj6fraa |
I want to get an angle between center of screen and mouse position to change animation direction. It same like Core Keeper. can someone help?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dpj6fraa |
I want to get an angle between center of screen and mouse position to change animation direction. It same like Core Keeper. can someone help?
Reply From: | sry295 |
if you want the player to face to mouse direction I suggest you use player position instead
var player_pos = $player.global_position
var mouse_pos = get_global_mouse_position()
then
var angle = player_pos.angle_to_point(mouse_pos)
P.S. if you want an angle in degree use
rad2deg(angle)