#### Archived

This topic is now archived and is closed to further replies.

# Vectors angles...

This topic is 6191 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have players, pl1 and pl2... pl2 is a AI i want hime to always look at pl1.. but how do I calc the angle pl2 shold look in?

##### Share on other sites
well, use plain trigonometry..

p2
.
.
. a
p1

TAN a = (p2.y - p1.y) / (p2.x - p1.x);

so, a is ATAN(TAN(a)) ...

This is only in 2 dims

for z then?

##### Share on other sites
Use the above code, but replace y with z...this gets the rotation on the y axis

then if you´re a little smart and so on, you can replace x with y, and you´ve got the x rotation

##### Share on other sites
"then if you´re a little smart and so on, you can replace x with y, and you´ve got the x rotation"

If you got a brain you will understand that it is not working that way! Think next time and reply then....

##### Share on other sites
What do you think we have trigonometry at school??? Right, to LEARN these things

Just get a piece of paper and figure out the formula...

I figured out the line-plane intersection formula all by myself in half-an-hour

##### Share on other sites
ooooooooh! If you are so smart? Can you tell me what people use forums for? Not for insults. Think and maybe you can understand why you got banned from IRC.. and maybe you can understand why your replys dont help anyone...

FLAME! FLAME!!!

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
A4L
12

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013541
×