From ZDoom Wiki
Jump to navigation Jump to search
For more information on this article, visit the A_FaceTarget page on the Doom Wiki.

A_FaceTarget [(float max_turn [, float max_pitch [, float ang_offset [, float pitch_offset [, int flags [, float z_ofs]]]]])]


Changes the calling actor's angle to face its current target. The target field can be set by spawning with A_SpawnItemEx.


  • angle: If specified, then the calling actor cannot turn by more than said angle. (A value of 0 is interpreted as unlimited angle.) However, the SHADOW flag has no effect in such case. Default is 0.
  • pitch: If specified to a value no greater than 180, then the calling actor's pitch is adjusted up to said value to face its current target. (A value of 0 is interpreted as unlimited angle; and technically a pitch change will never be greater than 180 degrees.) By default this is 270, which means its disabled. It will also aim at the actor's feet when set to 0.
  • ang_offset: Specifies the amount of degrees to offset the actor's angle. This is factored in after max_turn (otherwise known as angle) is performed. Note that it works just like A_SetAngle's parameter -- positive values will turn it left, negative values will turn it right. This does not factor in distance due to limitations. Default is 0.
  • pitch_offset: Adjusts pitch by this many degrees after max_pitch (also known as just pitch) has been taken into account. Default is 0.
  • flags: These may be combined by using the "|" character (without the quotes (")). Note that all of these flags are taken into account first before anything else. Default is 0.
    • FAF_BOTTOM - Aim for the bottom of the victim, 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 victim (z position + height / 2).
    • FAF_TOP - Aim for the top of the victim (z position + height).
  • z_add: Offsets the z position distance of the target by this number. Unlike pitch_offset, this takes into account how far away the actor is at all times. Default is 0.


Almost every monster uses this function before it shoots at its target.

  TROO EF 8 A_FaceTarget
  TROO G 6 A_TroopAttack  // See DoomImpBall
  goto See

This lost soul will home in on its target by calling A_FaceTarget and A_SkullAttack repeatedly.

actor HomingLostSoul : LostSoul
        SKUL C 10 bright A_FaceTarget
        SKUL D 4 bright A_SkullAttack
        SKUL CD 4 bright
        goto Missile+1

See also