UnrealScript: Triangle Radius
function bool IsInRadius(pawn P)
{
local vector A, B, C, D, E;local float AEdistanceX, EDdistanceY; //length of variable triangle
local float ACdistanceX, ABdistanceY; //length of base triangle
local float tABC, tADE;
A.X = location.X;
A.Y = location.Y;
A.Z = 0;B.X = location.X;
B.Y = location.Y + 768;
B.Z = 0;C.X = location.X + 768;
C.Y = location.Y;
C.Z = 0;D.X = P.location.X;
D.Y = P.location.Y;
D.Z = 0;E.X = P.location.X;
E.Y = location.Y;
E.Z = 0;AEdistanceX = SDistance(A.X, E.X);
EDdistanceY = SDistance(E.Y, D.Y);ACdistanceX = SDistance(A.X, C.X);
ABdistanceY = SDistance(A.Y, B.Y);tABC = TriangleBase(ACdistanceX, ABdistanceY);
tADE = TriangleBase(AEdistanceX, EDdistanceY);if (tABC > tADE)
{
return true;
}}
function float SDistance( float A, float B)
{
local float mydistance;mydistance = abs(abs(A)-abs(B));
return mydistance;
}
function float TriangleBase( float base, float height)
{
local float area;area = (0.5*(base)*(height));
return area;
}