/// <summary> /// calculate a unit's vertical distance (height) above ground level (mesh). this is the units position /// relative to the ground and is independent of any other character. note: this isn't actually the ground, /// it's the height from the mesh and the mesh is not guarranteed to be flush with the terrain (which is why we add the +2f) /// </summary> /// <param name="u">unit</param> /// <returns>float.MinValue if can't determine, otherwise distance off ground</returns> public static float HeightOffTheGround(this WoWUnit u) { var unitLoc = new Vector3(u.Location.X, u.Location.Y, u.Location.Z); float zBelow = u.FindGroundBelow(); if (zBelow == float.MaxValue) { return(float.MaxValue); } return(unitLoc.Z - zBelow); }