From 04c40eddfe1e95ff980feeaaa9c84a0b0e64774c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 20 Feb 2016 15:31:36 +0000 Subject: [PATCH] Add terrain height support to WithShadow. --- OpenRA.Mods.Common/Traits/Render/WithShadow.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs index 4ca045b587..eae5ab05e0 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithShadow.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithShadow.cs @@ -35,11 +35,12 @@ namespace OpenRA.Mods.Common.Traits public IEnumerable ModifyRender(Actor self, WorldRenderer wr, IEnumerable r) { // Contrails shouldn't cast shadows + var height = self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length; var shadowSprites = r.Where(s => !s.IsDecoration) .Select(a => a.WithPalette(wr.Palette(info.Palette)) - .OffsetBy(new WVec(0, 0, -a.Pos.Z)) - .WithZOffset(a.ZOffset + a.Pos.Z) - .AsDecoration()); + .OffsetBy(new WVec(0, 0, -height)) + .WithZOffset(a.ZOffset + height) + .AsDecoration()); return shadowSprites.Concat(r); }