###

» Sat Dec 13, 2008 12:58 am

For an idea I'm trying out, I need to compare whether the angle between the player and the obstacle is between two other angles. For example:

Is angle between player and obstacle within obstacle's angle + 45 and obstacle's angle - 45

This sort of thing works fine and dandy if I use a perfect square at an angle of 0, but I want to use squares of varying widths and heights that also have an arbitrary angle.

Finding the angles between each corner of the square i can do, it's the comparing of the angles that messes everything up, specifically, the 180 and -180 crossover point.

Using the 'is greater than' and 'is less than' comparisons gets stuffed when the range you're comparing crosses over the 180 mark.

Any help on resolving my issue?