private Extent CameraExtent() { // Determine what world coordinates are in the corners of our view corners = new Vector3[4]; corners[0] = GetCornerPoint(Corners.TOP_LEFT); corners[1] = GetCornerPoint(Corners.TOP_RIGHT); corners[2] = GetCornerPoint(Corners.BOTTOM_RIGHT); corners[3] = GetCornerPoint(Corners.BOTTOM_LEFT); // Determine the min and max X- en Z-value of the visible coordinates var unityMax = new Vector3(-9999999, -9999999, -99999999); var unityMin = new Vector3(9999999, 9999999, 9999999); for (int i = 0; i < 4; i++) { unityMin.x = Mathf.Min(unityMin.x, corners[i].x); unityMin.z = Mathf.Min(unityMin.z, corners[i].z); unityMax.x = Mathf.Max(unityMax.x, corners[i].x); unityMax.z = Mathf.Max(unityMax.z, corners[i].z); } // Convert min and max to WGS84 coordinates var wGSMin = CoordConvert.UnitytoWGS84(unityMin); var wGSMax = CoordConvert.UnitytoWGS84(unityMax); // Area that should be loaded var extent = new Extent(wGSMin.lon, wGSMin.lat, wGSMax.lon, wGSMax.lat); return(extent); }
private Extent CalculateExtents() { corners = new UnityEngine.Vector3[4]; corners[0] = transform.position + topLeft; corners[1] = transform.position + topRight; corners[2] = transform.position + bottomRight; corners[3] = transform.position + bottomLeft; // Determine the min and max X- en Z-value of the visible coordinates var unityMax = new UnityEngine.Vector3(-9999999, -9999999, -99999999); var unityMin = new UnityEngine.Vector3(9999999, 9999999, 9999999); for (int i = 0; i < 4; i++) { unityMin.x = Mathf.Min(unityMin.x, corners[i].x); unityMin.z = Mathf.Min(unityMin.z, corners[i].z); unityMax.x = Mathf.Max(unityMax.x, corners[i].x); unityMax.z = Mathf.Max(unityMax.z, corners[i].z); } // Convert min and max to WGS84 coordinates var wGSMin = CoordConvert.UnitytoWGS84(unityMin); var wGSMax = CoordConvert.UnitytoWGS84(unityMax); // Area that should be loaded var extent = new Extent(wGSMin.lon, wGSMin.lat, wGSMax.lon, wGSMax.lat); return(extent); }
private void SetGPSCoordinates() { //Get the GPS coordinates for our world centre var coordinates = CoordConvert.UnitytoWGS84(Vector3.zero); longitude = coordinates.lon; latitude = coordinates.lat; }