0 votes

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?

in Engine by (12 points)

1 Answer

0 votes

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)
by (133 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 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.