A_Face

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



Actor

void A_Face (Actor faceto, double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0)

Usage

Makes the calling actor face the actor specified by the faceto parameter. This is a generalized actor facing function of A_FaceTarget, A_FaceTracer and A_FaceMaster.

Parameters

  • faceto: A pointer to the actor that the function should make the caller face.
  • max_turn: The maximum turn angle; the calling actor cannot turn by more than said angle, however the SHADOW flag has no effect in such case. A value of 0 is interpreted as unlimited angle. Default is 0.
  • max_pitch: If specified to a value no greater than 180, then the calling actor's pitch is adjusted up to said value to face the actor. A value of 0 is interpreted as unlimited angle; and technically a pitch change will never be greater than 180 degrees. It will also aim at the actor's feet when set to 0. Default is 270, which means its disabled.
  • ang_offset: Specifies the amount of degrees to offset the actor's angle by. Positive values turn it left, while negative values turn it right. This is factored in after max_turn is performed. Due to limitations, distance is not factored in. Default is 0.
  • pitch_offset: Adjusts the pitch by this many degrees after max_pitch has been taken into account. Default is 0.
  • flags: Customizes the behavior of the function. Multiple flags can be combined by using the bitwise OR operator (|) between the constant names:
    • FAF_BOTTOM — Aim for the bottom of the actor, otherwise known as the raw Z position. Whenever max_pitch is taken into account, it will aim towards the actor's feet + 32 units above. This flag disables adding that 32 units.
    • FAF_MIDDLE — Aim for the middle of the actor (z position + height / 2).
    • FAF_TOP — Aim for the top of the actor (z position + height).
Note that all of these flags are taken into account first before anything else.
Default is 0.
  • z_ofs: Offsets the z position distance of the actor to face by this amount. Unlike pitch_offset, this takes into account how far away the actor is at all times. Default is 0.

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.