Here is a fabs rendition for those who are curious
int GetIsFlanked(object oAttacker, object oTarget, float fAngle = 90.0, object oAlly = OBJECT_INVALID)
{
float fToAttacker = VectorToAngle(GetPosition(oAttacker)- GetPosition(oTarget));
float fToFacing;
if(GetIsObjectValid(oAlly))
fToFacing = VectorToAngle(GetPosition(oAlly) - GetPosition(oTarget));
else
fToFacing = GetFacing(oTarget);
float fBackArc = fabs(fabs(fToAttacker - fToFacing) - 180.0);
return (fBackArc <= fAngle/2);
}
Modifié par WhiZard, 17 septembre 2013 - 03:29 .