gettargetpitch

From ZDoom Wiki

Jump to: navigation, search
This function acts as an extension to VectorAngle, it returns the relative pitch of a thing with tid2, from a thing with tid1. This function requires the inclusion of the sqrt function.
function int GetTargetPitch (int tid1, int tid2)
{
    int x, y, z, xy;
    x = GetActorX(tid2) - GetActorX(tid1) >> 16;
    y = GetActorY(tid2) - GetActorY(tid1) >> 16;
    z = GetActorZ(tid2) - GetActorZ(tid1);
    xy = sqrt (x*x + y*y) << 16;
    return VectorAngle(z, xy) - 0.25;
}
Personal tools