Advertisement

isfacingpoint

Started by October 19, 2002 05:55 PM
3 comments, last by Raging Teen 22 years, 4 months ago
// returns if unit is facing within (degrees) degrees of point //angle that the object is facing, where to face, within how many degrees //bob includes x and y positions and directions and other things if you want to assume char isfacingpoint(OT *bob,float xpos,float ypos,int degrees) any quick(or even non quick) ways to do this? It has been troubling my brain all afternoon [edited by - Raging Teen on October 19, 2002 7:14:28 PM]
I''m not sure what you mean. Do you want to find the angle between two vectors? Use the dot product for that.

Cédric
Advertisement
no no no, I''ve reduced the problem down to I have 2 angles now between +180 and -180 off the x axis and I want to know whether they are within X degrees of each other.
Uh...

|angle1 - angle2| < x

?

Cédric
|angle1 - angle2| < x OR 360 - |angle1 - angle2| < x

This topic is closed to new replies.

Advertisement