converting Position to Position into angle, then, cardinals

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

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


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 !

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.

quizzcode | 2021-08-30 07:29

:bust_in_silhouette: Reply From: flavia110

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. The figure shows some positive angles labeled in both degrees and radians.