You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
I am trying to get a "Pokemon GO"-like effect, with the camera pitch varying depending on its altitude. I am restricting the camera zoom level from 17 to 19, so it's always close to the ground.
Aerial view:
Closer to the ground:
I have written a simple linear function that I plan to improve, returning a value (the pitch) that should always be between ~40 (for a zoom level of 17) and ~100 (for a zoom level of 19).
Unfortunately, methods such as -mapViewRegionIsChanging: get called in response to programmatic camera changes in addition to user-initiated camera changes. So changing the camera within -mapViewRegionIsChanging: causes recursion unless you explicitly guard against it with a base case. For example, the method could bail if the pitch is already the same as what you’d change it to.
(Relatedly, #6908 tracks varying the maximum pitch by the altitude or zoom level.)
Thank you for your answer, and all the work you're doing on this project.
Is there maybe another way to achieve this varying pitch feature, maybe from another delegate method? I have read the related issue and it looks like there is no easy way to do so, or maybe have I missed something.
@StratRob until we fix the core underlying issue, I'd recommend trying to call setCamera from a DispatchQueue.main.async. See #14998 (comment) for a similar issue.
Can you please try this and let me know if this works for you? Thanks
Hello,
I am trying to get a "Pokemon GO"-like effect, with the camera pitch varying depending on its altitude. I am restricting the camera zoom level from 17 to 19, so it's always close to the ground.
Aerial view:
Closer to the ground:
I have written a simple linear function that I plan to improve, returning a value (the pitch) that should always be between ~40 (for a zoom level of 17) and ~100 (for a zoom level of 19).
Then I simply thought it would be enough to call
mapViewRegionIsChanging
delegate function, and updating the pitch from here:But I end up getting something that looks a lot like an infinite loop and then the app crashes:
Can you help me with that? I didn't know where to ask so I hope it's the right place, sorry if not.
Thanks for your help.
Configuration
Mapbox SDK versions: 4.9.0
iOS/macOS versions: 12.1.4
Device/simulator models: iPhone XR
Xcode version: 10.1
The text was updated successfully, but these errors were encountered: