GetActorPitch

From ZDoom Wiki
Jump to navigation Jump to search

fixed GetActorPitch (int tid)

Usage

Returns the actor's pitch.

Parameters

  • tid: TID of the actor. Passing 0 will get the activator's pitch.

Return value

The actor's pitch is a fixed point angle. Due to the limits of freelook in the software renderer, this value is bounded by -0.0888977 (approximately -32°) and 0.155548 (approximately 56°), more precisely -5825 and 10194 as ints, but in GL freelook will go from -0.25 (-90°) to 0.25 (+90°). Note that looking up produces a negative value and looking down produces a positive value. 0 is looking straight ahead.

Examples

This script will alter the trajectory of a DoomImpBall fired from a thing with a TID of 1 based on the pitch of the activator.

script 1 (void)
{
    int speed, vspeed;
    speed = cos(GetActorPitch(0)) * 64 >> 16;
    vspeed = -sin(GetActorPitch(0)) * 64 >> 16;
    SpawnProjectile(1, "DoomImpBall", 0, speed, vspeed, 1, 0);
}

For more advanced uses, see the Cleaned up Third Person Cam tutorial or the hudmessageonactor function.