From ZDoom Wiki
Jump to navigation Jump to search

fixed GetActorAngle (int tid)


Returns the actor's angle. If tid is 0, the function uses the activator.


  • tid: TID of the actor.

Return value

The actor's angle as a fixed point angle.


This script will thrust an actor in the direction the player is facing when executed. This could be used to simulating pushing an actor away from you. The >> 8 function is used to convert fixed point angles to byte angles (see Definitions for more information).

script 10 ENTER
    ThrustThing(GetActorAngle(0) >> 8, 50, 1, 0);

This script prints reversed actor's angle.

script 15 (int monsterid)
    //this will obtain current actor's angle and convert to byte angle.
    int angle = GetActorAngle(monsterid) >> 8;
    /*Looking at Byte Angle table we know that we can't turn an actor
    180 degrees with negative value*/
    //This function is easiest way to do it.
    if (angle < 128)
    angle = angle + 128;
    else angle = angle - 128;
   /*E.g. if actor is facing north, it's byte angle is 64, we want it's reverted angle.
   So 64 < 128 , 64 + 128 = 192 which is south.*/
     //prints reversed angle.