public void setAltitude(double newAltitude) { Wrld.Space.LatLongAltitude latLongAltitude = new Wrld.Space.LatLongAltitude(); latLongAltitude.SetAltitude(m_distanceToInterest);//// latLongAltitude.SetLatitude(m_latitudeDegrees); latLongAltitude.SetLongitude(m_longitudeDegrees); m_api.SetOriginPoint(latLongAltitude); LatLong latLong = latLongAltitude.GetLatLong(); m_distanceToInterest = newAltitude; Api.Instance.CameraApi.AnimateTo(latLong, distanceFromInterest: m_distanceToInterest, headingDegrees: m_headingDegrees, tiltDegrees: 0); }
void SetupApi() { var config = ConfigParams.MakeDefaultConfig(); config.DistanceToInterest = m_distanceToInterest; config.LatitudeDegrees = m_latitudeDegrees; config.LongitudeDegrees = m_longitudeDegrees; config.HeadingDegrees = m_headingDegrees; config.StreamingLodBasedOnDistance = m_streamingLodBasedOnDistance; config.MaterialsDirectory = m_materialDirectory; config.OverrideLandmarkMaterial = m_overrideLandmarkMaterial; config.Collisions.TerrainCollision = m_terrainCollisions; config.Collisions.RoadCollision = m_roadCollisions; config.Collisions.BuildingCollision = m_buildingCollisions; config.EnableLabels = m_enableLabels; try { Api.Create(GetApiKey(), m_coordSystem, transform, config); } catch (InvalidApiKeyException) { #if UNITY_EDITOR EditorUtility.DisplayDialog( "Error: Invalid WRLD API Key", string.Format("Please enter a valid WRLD API Key (see the WrldMap script on GameObject \"{0}\" in the Inspector).", gameObject.name), "OK"); #endif throw; } m_api = Api.Instance; if (m_useBuiltInCameraControls) { m_api.CameraApi.SetControlledCamera(m_streamingCamera); } Wrld.Space.LatLongAltitude latLongAltitude = new Wrld.Space.LatLongAltitude(); latLongAltitude.SetAltitude(0); ///// latLongAltitude.SetLatitude(m_latitudeDegrees); latLongAltitude.SetLongitude(m_longitudeDegrees); m_api.SetOriginPoint(latLongAltitude); }
void redrawMap() { Vector3 currentMapPosition = gameObject.transform.position; gameObject.transform.parent.transform.position = originalMapPosition; gameObject.transform.position = currentMapPosition; //position of map relative to the map's pivot double x_offset = gameObject.transform.localPosition.x; double z_offset = gameObject.transform.localPosition.z; //coordinates for the api call... double[] newCoordinates = getNewCoordinates(x_offset, z_offset, m_latitudeDegrees, m_longitudeDegrees); m_latitudeDegrees = newCoordinates[0]; m_longitudeDegrees = newCoordinates[1]; //map's centroid is now at the new latlong Wrld.Space.LatLongAltitude latLongAltitude = new Wrld.Space.LatLongAltitude(); latLongAltitude.SetAltitude(0);//// latLongAltitude.SetLatitude(m_latitudeDegrees); latLongAltitude.SetLongitude(m_longitudeDegrees); m_api.SetOriginPoint(latLongAltitude); LatLong latLong = latLongAltitude.GetLatLong(); //transform.position = new Vector3(0.0f, transform.position.y, 0.0f); transform.position = originalMapPosition; //generate new map around the center of the map Api.Instance.CameraApi.AnimateTo(latLong, distanceFromInterest: m_distanceToInterest, headingDegrees: m_headingDegrees, tiltDegrees: 0); //reset the grab offset because if you are grabbing the object while redrawMap() is called, the map is repositioned, but also the grab offset is preserved, so the map is moved double the desired distance. if (GameObject.Find("Controllers").GetComponent <TwoHandControl>().twoGrabbed()) { GameObject.Find("Controllers").GetComponent <TwoHandControl>().recomputeOffset(); } else { GameObject.Find("Controller (right)").GetComponent <OneHandControl>().recomputeOffset(); GameObject.Find("Controller (left)").GetComponent <OneHandControl>().recomputeOffset(); } }