UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 8

249

if (OutBox.Min.Y > BoundingBoxCoords[i].Y)
{
OutBox.Min.Y = BoundingBoxCoords[i].Y;
}

/** Detect the largest X coords */
if (OutBox.Max.X < BoundingBoxCoords[i].X)
{
OutBox.Max.X = BoundingBoxCoords[i].X;
}

/** Detect the largest Y coords */
if (OutBox.Max.Y < BoundingBoxCoords[i].Y)
{
OutBox.Max.Y = BoundingBoxCoords[i].Y;
}
}
return OutBox;
}


  1. That's all there is to it! Compile the project and point your pawn towards another
    pawn to see a bounding box drawn around it.

Free download pdf