Add Map.DistanceAboveTerrain(WPos) and Actor.IsAtGroundLevel() extension method

This commit is contained in:
Taryn Hill
2015-08-01 07:53:14 -05:00
parent 7066254887
commit 6fa1f757b0
8 changed files with 36 additions and 13 deletions

View File

@@ -104,8 +104,7 @@ namespace OpenRA.Mods.Common.Graphics
public void Render(WorldRenderer wr)
{
// TODO: This is a temporary workaround until we have a proper ramp-aware height calculation
var groundPos = wr.World.Map.CenterOfCell(wr.World.Map.CellContaining(voxel.pos));
var groundPos = voxel.pos - new WVec(0, 0, wr.World.Map.DistanceAboveTerrain(voxel.pos).Length);
var ts = Game.ModData.Manifest.TileSize;
var groundZ = ts.Height * (groundPos.Z - voxel.pos.Z) / 1024f;