private static Coordinates GroundCoordinates(double x, double z, TerrainCollider ground) { double y = ground == null ? 0: (double)ground.GetHeight((float)x, (float)z); y += heightBuffer; return(new Coordinates(x, y, z)); }