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!
Getting x,y angles from vector
[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]
[/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]
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement