0 votes

Hey there
I'm trying to define the cardinal direction from TARGET to TOWER node.
Tower is fixed and target move. I need to define weather the monster is NE from the tower or S to match the directional animations I have for the tower.

I'm ALOMOST there. maybe someone can check this and let me know how to fix it ?

I start by using

 TOWER.position.direction_to(TARGET.position)

then i use to define an angle.
But I find this angle weird and not matching "normal" angles such as 90, to25, to 45 etc...

angle = rad2deg(angle.angle())

Then I have a list of IF/ELIF angle>=90 and angle <= 45 makes cardinal = N.
But this doesn't seem to be working properly.
Any idea on how I could approach this ?
Thanks !

in Engine by (184 points)

NVM this works perfectly fine.
Apparently In Godot a rotation of 0° defaults to a vector pointing right
so my degress were simply not matching godot's standard.

1 Answer

0 votes

The positive angles on the unit circle are measured with the initial side on the positive x-axis and the terminal side moving counterclockwise around the origin. https://royaldissertationhelp.co.uk/ The figure shows some positive angles labeled in both degrees and radians.

by (22 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.