wrld3d / ios-api

iOS API for WRLD: Stunning, Interactive 3D Maps
BSD 2-Clause "Simplified" License
19 stars 7 forks source link

Camera animation is very jerky when using realtime location #28

Open jdrobert opened 6 years ago

jdrobert commented 6 years ago

Description

Camera animation is very jerky when using realtime location

Steps to Reproduce

Update map position based on current location. The larger the distance between updates (the faster the object is going) the worse the problem shows.

The easiest way to reproduce is to set the location of the simulator to "Freeway Drive". I've also tested this on a device and see the same jerkiness.

Expected behavior: Changes in the current location should be smoothly updated.

Actual behavior: Changes in the current location are not smoothly updated like Apple Maps

Reproduces how often: 100%

Additional Information

Code:

import UIKit
import Wrld

class LocationViewController: UIViewController {
    private let locationManager = CLLocationManager()
    @IBOutlet private weak var mapView: WRLDMapView!

    override func viewDidLoad() {
        super.viewDidLoad()
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
    }
  }

  extension LocationViewController: CLLocationManagerDelegate {
      func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
            if let location = locations.last{
                //The same result happens if animated is false. 
                mapView.setCenter(location.coordinate, zoomLevel: 30, animated: true)
            }
        }
  }

Example: wrld3d