void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
        {
            _locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;
            _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);

            transform.position = new Vector3(0, 0, 0);
        }
 private void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
 {
     if (_isMapInitialized && location.IsLocationUpdated)
     {
         StartLerping(location);
     }
 }
 void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
 {
     if (_isMapInitialized && location.IsLocationUpdated)
     {
         _targetPosition = _map.GeoToWorldPosition(location.LatitudeLongitude, false);
     }
 }
        void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
        {
            _locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;

            //initialize the map to Peel Park every time
            //_map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);
            _map.Initialize(new Vector2d(53.486786, -2.271412), 16);
        }
 private void LocationProvider_OnFirstLocationUpdate(Unity.Location.Location location)
 {
     _locationProvider.OnLocationUpdated -= LocationProvider_OnFirstLocationUpdate;
     _map.OnInitialized += () =>
     {
         _isMapInitialized = true;
         _locationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated;
     };
     _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);
 }
        /// <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);
        }
Example #7
0
        void _locationProvider_OnLocationUpdated(Unity.Location.Location location)
        {
            var heading = location.Heading;

            var alignment = new Alignment();

            var   originalPosition = _map.Root.position;
            float arRotationOffset = ARCamera.eulerAngles.y;

            alignment.Rotation = -heading + arRotationOffset;

            // Rotate our offset by the last heading.
            var rotation = Quaternion.Euler(0, -heading + arRotationOffset, 0);

            Debug.Log("Current Position" + ARCamera.position);

            Vector3 arPositionOffset = ARCamera.position;

            alignment.Position = rotation * (-Conversions.GeoToWorldPosition(location.LatitudeLongitude,
                                                                             _map.CenterMercator,
                                                                             _map.WorldRelativeScale).ToVector3xz());

            alignment.Position  += arPositionOffset;
            alignment.Position.y = _lastHeight;
            Debug.Log("Alignment");
            OnAlignmentAvailable(alignment);

            // Reset camera to avoid confusion.
            var mapCameraPosition = Vector3.zero;

            mapCameraPosition.y = _mapCamera.localPosition.y;
            var mapCameraRotation = Vector3.zero;

            mapCameraRotation.x      = _mapCamera.localEulerAngles.x;
            _mapCamera.localPosition = mapCameraPosition;
            _mapCamera.eulerAngles   = mapCameraRotation;
        }
 void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
 {
     _locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;
     _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);
 }
 void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
 {
     _locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;
     _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);
     //LocationText.GetComponent<Text>().text = location.LatitudeLongitude.ToString();
 }
Example #10
0
 void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
 {
     Debug.Log("InitializeMapWithLocationProvider: " + "WTF");
     _locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;
     _map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);
 }