gettargetangle

This function acts as an extension to VectorAngle, it returns the relative angle of a thing with tid2, from a thing with tid1.

function int GetTargetAngle (int tid1, int tid2)
{
    int x, y;
    x = GetActorX(tid2) - GetActorX(tid1);
    y = GetActorY(tid2) - GetActorY(tid1);
    return VectorAngle(x, y);
}
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.