Check If an Angle is within Arc of another Angle

A simple library to tell if an angle is within an arc of another angle.

A few notes with it, "Facing angle of unit" and "Angle between points" among others actually return a range of -180 through 180 by default, and this accounts for that. It adds 180 to whatever the input is. If you input your own angles that are not from Blizzard's system, remove 180 from what you have. Angles can only be -180 through 180, anything above or below will screw up.

Also, you must remove the function and two variables from the library file to use them. If in arc variable is a simple yes or no boolean. Returned angle is either the angle you are checking to see if it is in the arc of the other angle, and if it is not in the arc then it will return either the highest or lowest value depending on which is closer.

This is probably far from perfect, maybe even a little inefficient, but it works for exactly what l need it to, which is run every 16th of a second without much lag.

Bugs.. Are to be expected. l don't know if converting it from non-variables (Facing angle of unit) screwed anything up, as l may have done some things wrong, but l don't think l did.

This is NOT extensively tested. You've been warned.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    76249
  • Created
    Mar 15, 2014
  • Last Released File
    Mar 15, 2014
  • Total Downloads
    136
  • License

Categories

Members