Advertisement

Getting x,y angles from vector

Started by April 24, 2011 12:24 PM
3 comments, last by Emergent 13 years, 6 months ago
Hi anybody!

 I want implement an AI bot for FPS. First I collided with "how to turn bot's eye at enemy's position".  

How to do it if input variable is 3D vector that contains a direction to relative enemy's position and output is angles (x,y)? 

Thanks for ANY help!
[font=arial, verdana, tahoma, sans-serif][size=2]First, you probably don't need to use angles, and your code would be simpler, faster and less likely to be buggy if you didn't use them.[/font][font=arial, verdana, tahoma, sans-serif][size=2]
[/font][font=arial, verdana, tahoma, sans-serif][size=2]If you do use angles, you need to know that angles are tricky things in 3D. What exactly do you mean by "angles (x,y)"? The only angles I know are the angle between two vectors (the arccos of their dot product) and the angle that specifies how much to rotate around an axis. Try to be as precise as possible so we can map the angles you want to one of these concepts.[/font][font=arial, verdana, tahoma, sans-serif][size=2]
[/font][font=arial, verdana, tahoma, sans-serif][size=2]
[/font]
Advertisement
As a note, I'm pretty close to moving this topic to Math/Physics since it really isn't about AI. You might get more help there. I figured I would give our regulars a a chance to weigh in. If you haven't gotten an answer by later today, I'll move it.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

No, thanks guys. I have found out way to do that (by atan2(...)). Now I go on setting up AI instructions. Thanks for attention!
Every time I read a question like this, I get a pained expression, and the urge to replace high school geometry and trig with a class you might call "Intro to Inner Product Spaces."

This topic is closed to new replies.

Advertisement