Fix Rectangle OuterRadius
Rectangle shapes always assumed that either top-left or bottom-right would have the largest distance from actor center, which is wrong, because depending on the position of the shape, top-right or bottom-left can be the furthest away corner as well, potentially resulting in a too small OuterRadius.
This commit is contained in:
@@ -67,7 +67,10 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
quadrantSize = (BottomRight - TopLeft) / 2;
|
||||
center = TopLeft + quadrantSize;
|
||||
|
||||
OuterRadius = new WDist(Math.Max(TopLeft.Length, BottomRight.Length));
|
||||
var topRight = new int2(BottomRight.X, TopLeft.Y);
|
||||
var bottomLeft = new int2(TopLeft.X, BottomRight.Y);
|
||||
var corners = new[] { TopLeft, BottomRight, topRight, bottomLeft };
|
||||
OuterRadius = new WDist(corners.Select(x => x.Length).Max());
|
||||
|
||||
combatOverlayVertsTop = new WVec[]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user