diff --git a/OpenRa.Game/Actor.cs b/OpenRa.Game/Actor.cs index 85f15b5c24..e860afd679 100755 --- a/OpenRa.Game/Actor.cs +++ b/OpenRa.Game/Actor.cs @@ -102,6 +102,11 @@ namespace OpenRa.Game { var size = SelectedSize; var loc = CenterLocation - 0.5f * size; + var unit = traits.GetOrDefault(); + + if (unit != null) + loc -= new float2(0, unit.Altitude); + return new RectangleF(loc.X, loc.Y, size.X, size.Y); } } diff --git a/OpenRa.Game/Graphics/WorldRenderer.cs b/OpenRa.Game/Graphics/WorldRenderer.cs index 61890751c5..66e0664712 100644 --- a/OpenRa.Game/Graphics/WorldRenderer.cs +++ b/OpenRa.Game/Graphics/WorldRenderer.cs @@ -95,13 +95,12 @@ namespace OpenRa.Game.Graphics public void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar) { - var center = selectedUnit.CenterLocation; - var size = selectedUnit.SelectedSize; + var bounds = selectedUnit.Bounds; - var xy = center - 0.5f * size; - var XY = center + 0.5f * size; - var Xy = new float2(XY.X, xy.Y); - var xY = new float2(xy.X, XY.Y); + var xy = new float2(bounds.Left, bounds.Top); + var Xy = new float2(bounds.Right, bounds.Top); + var xY = new float2(bounds.Left, bounds.Bottom); + var XY = new float2(bounds.Right, bounds.Bottom); lineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c); lineRenderer.DrawLine(xy, xy + new float2(0, 4), c, c); @@ -121,7 +120,8 @@ namespace OpenRa.Game.Graphics if (selectedUnit.Owner == Game.LocalPlayer) { DrawPips(selectedUnit, xY); - DrawTags(selectedUnit, new float2(center.X, xy.Y)); + DrawTags(selectedUnit, + new float2(.5f * (bounds.Left + bounds.Right ), xy.Y)); } }