Finding the angle of a single vector?

Hey guys, its been a while since ive been here. Everything still lookin’ good btw!

I have quick question about vectors. What i’m trying to do is figure out the angle of an object from its x,y coordinate. The problem is i have no clue what the syntax should be. I cant use the orientation matrix because the object itself is not actually rotating. Here’s a blend file if it helps. Thanks!


circle_angle.blend (142 KB)

Working with vectors I think you should check out the mathutils module. (

Is this .blend file what you want?


circle_angle1.blend (142 KB)

#here's the problem area:
own.deg = degrees(tan(own.y // own.x))

should be

#here's the problem area:
own.deg = degrees( <i><b><i>atan </i></b></i>(own.y // own.x))

Perhaps? Or that could just be syntax. Yeah the mathutils module is awesome for this stuff, try the angleBetweenVecs function

Thanks guys this is awesome! is there any way to get a full 360 range? i need ecah point to be unique or my plan wont work. Thanks!

To Wraah’s method, just add

if vec2[1]&lt;0:
    own.deg = 360-own.deg

to the end of the code

I see what your attempting to do, but it doesn’t seem to be working for me…

woah second paged after one day? this site is getting big!

Open it up, check it out. Seems to work :rolleyes:


circle_angle_full_circle.blend (142 KB)

double post :stuck_out_tongue:

Awwwww it was my own problem. i forgot to add that to the reference spot too! Thank you guys sooo much! both of you are life savers! I owe you guys HUGE! :smiley: