GetAngle

From ZDoom Wiki
Jump to navigation Jump to search

float GetAngle (int flags [, int ptr_select])

Usage

Returns the angle of the line going from the caller to the pointer given. The format is in double floatation precision constricted between [-180.0, 180.0], so an actor checking a target north of it will be 90, south -90, east 0, etc.

Note that this function is to be used where an expression is expected. It is mostly useful when combined with A_JumpIf or Anonymous Functions and can be used in place of such functions like A_JumpIfTargetInLOS.

Parameters

  • flags: Flags can be combined with the | symbol.
    • GAF_RELATIVE: Normally this function returns the absolute angle of the line from the caller to the pointer (i.e., relative to facing due east). This flag has the function return the angle relative to the caller's angle instead.
    • GAF_SWITCH: Checks the line going from the pointer to the angle instead. If used with GAF_RELATIVE, will also be relative to the pointer's angle not the caller's.
  • ptr_select: The pointer to examine. Default is AAPTR_TARGET. Must be a pointer other than AAPTR_DEFAULT or AAPTR_NULL. See actor pointers.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.