From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


native clearscope static double deltaangle(double ang1, double ang2)


Used to find the relative change from one angle to another, because raw actor angles may not always be normalized. For example, the player's angle variable can return inconsistent results if the player has turned a complete circle.

If you need to check only the difference between the angles regardless of direction, consider AbsAngle instead.


  • ang1: The first angle to be compared.
  • ang2: The angle to be subtracted from the first.

Return Value

  • The difference between the two angles, normalized to between [-180,180]. Negative values mean ang2 is to the right of ang1, while positive values mean ang2 is to the left of ang1.


This replicates the GetAngle functionality with GAF_RELATIVE specified. Keep in mind this accounts for being on one particular side, not both. If both is needed, use AbsAngle instead.

if (target && deltaangle(angle, AngleTo(target)) < 20)

See Also