void LocationProvider_OnLocationUpdated(Unity.Location.Location location) { if (_isMapInitialized && location.IsLocationUpdated) { _targetPosition = _map.GeoToWorldPosition(location.LatitudeLongitude, false); } }
/// <summary> /// Called to begin the linear interpolation /// </summary> private void StartLerping(Unity.Location.Location location) { _isLerping = true; _timeStartedLerping = Time.time; timeTakenDuringLerp = Time.deltaTime; //We set the start position to the current position _startLatLong = _map.CenterLatitudeLongitude; _endLatlong = location.LatitudeLongitude; _startPosition = _map.GeoToWorldPosition(_startLatLong, false); _endPosition = _map.GeoToWorldPosition(_endLatlong, false); }
public void updateLocation(Location location, bool isInitialLocation, bool isHeadingUpdated, bool isLatLngUpdated) { currentLoc = location; if (isInitialLocation == true) { Debug.Log("Initial location set: " + location.LatitudeLongitude.ToString() + " with heading: " + location.Heading); setMapOrientation(location.Heading); StartCoroutine(getTrailsForLocation(location, 50)); StartCoroutine(annotationHandler.SetupMap()); } if (isHeadingUpdated) { // playerLocation.transform.Rotate(Vector3.up, location.Heading); } if (isLatLngUpdated) { if (map == null) { map = (Mapbox.Unity.Map.AbstractMap)mapObject.GetComponent((typeof(Mapbox.Unity.Map.AbstractMap))); } Vector3 destinationVec = map.GeoToWorldPosition(location.LatitudeLongitude); float height = directionHandler.getHeightForPosition(location.LatitudeLongitude); Debug.Log("height at new position: " + height); nextPlayerPosition = new Vector3(destinationVec.x, playerObject.transform.localPosition.y, destinationVec.z); } }