mapbox / mapbox-gl-native-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and OpenGL
https://www.mapbox.com/mobile/
Other
210 stars 121 forks source link

MGLUserLocationAnnotationView subclass does not take the pitch perspective of the camera #488

Open desmeit opened 4 years ago

desmeit commented 4 years ago

I have styled the user location icon according to these docs:

https://docs.mapbox.com/ios/maps/examples/user-location-annotation/

It works, but although I worked with camera and pitch, it is displayed in two dimensions. How can i make it that it is in the right perspective of the camera and the pitch effect works?

IMG_5069

I added MGLMapCamera with this code:

func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {
       // Wait for the map to load before initiating the first camera movement.

       mapView.camera = MGLMapCamera(lookingAtCenter: mapView.centerCoordinate, altitude: 200, pitch: 50, heading: 0)

}

Isn't there a camera option mode like gps for Android? https://docs.mapbox.com/android/maps/examples/location-component-camera-options/

desmeit commented 4 years ago

Does Mapbox not provide support? The documentation is very simple. There is no information and then there is apparently no support. What a pity.

1ec5 commented 3 years ago

Hi, mapbox/mapbox-gl-native is the repository for the cross-platform GL Native library that both the Android and iOS map SDKs use under the hood. For most things involving the iOS map SDK, the mapbox/mapbox-gl-native-ios repository is a better starting point. I’ve moved this issue to avoid confusion.

1ec5 commented 3 years ago

MGLUserLocationAnnotationView doesn’t automatically tilt the view, but you can implement it the same way that the built-in implementation does:

https://github.com/mapbox/mapbox-gl-native-ios/blob/86891739543d6cc3049924e68bbc70ec2c1c5870/platform/ios/src/MGLFaux3DUserLocationAnnotationView.mm#L144-L147 https://github.com/mapbox/mapbox-gl-native-ios/blob/86891739543d6cc3049924e68bbc70ec2c1c5870/platform/ios/src/MGLFaux3DUserLocationAnnotationView.mm#L173

mapbox/mapbox-gl-native#10498 tracked adding a built-in way to make any annotation view tilted, not just a user location indicator, but it’s unlikely to be fixed ahead of an overhaul of annotations.