A_FaceTarget

From ZDoom Wiki
Jump to: navigation, search

A_FaceTarget [(float angle[, float pitch])]

Changes the calling actor's angle to face its current target.

If angle is 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.

If pitch is specified to a value no greater than 180, then the calling actor's pitch is adjusted by 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.)

Examples

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

Missile:
  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 repeatedly.

actor HomingLostSoul : LostSoul
{
    States
    {
    Missile:
        SKUL C 10 bright A_FaceTarget
        SKUL D 4 bright A_SkullAttack
        SKUL CD 4 bright
        SKUL C 0 bright A_FaceTarget
        goto Missile+2
    }
}

See also

Personal tools
Namespaces

Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox