Help with 2d top down shooter question

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
ismetteren
Chaos Rift Junior
Chaos Rift Junior
Posts: 276
Joined: Mon Jul 21, 2008 4:13 pm

Re: Help with 2d top down shooter question

Post by ismetteren »

GyroVorbis wrote: The angle between the two is simply the inverse cosine of the X component of our normalized vector. That's one additional trig function.
Shouldn't you check if the y component is negative and add pi radians if it is?

I guess this method could also be described by just using the unit circle and not event talk about dot products, for this specific case (which i guess is not uncommon) where you want to find the angle between a vector and the x axis.
Image ImageImage Image
Post Reply