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

double deltaangle (double angle1, double angle2)


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.


  • angle1: The first angle to be compared.
  • angle2: The angle to be subtracted from the first.

Return Value

  • The difference between the two angles, normalized to between [-180,180].


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