-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model Position Incorrectly Changed from Centre for some Coordinates #2176
Comments
Hi @programmer443 - Thanks for sharing this report and the code sample. To help us replicate, could you provide a smaller example with actual values for the variables in your code for latitude, longitude, etc? This will help to isolate if the issue is in the SDK rather than with incorrect data. It would be especially helpful if you could recreate the issue outside of your application in a simple implementation of the SDK. For example, you could modify one of our examples. |
Hi @pjleonard37, Thanks for your reply🙂. I updated my code with actual values for your understanding. Now, I hope so it will help you to reproduce the issue. Here is example project for your reference |
Hi @programmer443 -- Thanks for sharing this sample project; I was able to replicate the behavior in your project. I think the issue is related to how you've set up the SwiftUI <--> UIKit code. I was able to strip down the code a bit more and have made some changes to center the plane model: Instead of using a Swift UI and UIKit together, I just implemented the solution in Swift UI, which resolves the misalignment you were seeing. Note that this code takes advantage of new SDK features released in the
These features are currently experimental, so breaking changes may occur across versions. As we refine these features we are very interested in hearing your feedback! One other note: I'd recommend rotating the access token in your shared project. Instructions can be found here: https://docs.mapbox.com/accounts/guides/tokens/#rotating-access-tokens. |
Hi @pjleonard37 , For model translation I am using this code:
And for camera position I'm using same above code. Video: sample.mp4 |
@pjleonard37 just checking in on the status of this issue—any updates or ETA for a resolution? |
Hi @programmer443 -- I have not been able to reproduce the issue you are seeing locally, and am still investigating. As a friendly reminder, Model layers are an experimental feature. |
Hi @pjleonard37 @astojilj, Related link: #2152 |
Hi @programmer443 - I'm glad to hear that your implementation has been simplified using SwiftUI.
Just to confirm, when you set the maxZoom the issue was resolved for you? |
Hi @pjleonard37 Yes, if I set maxzoom to 6+ the model is positioned in the center but it disappears randomly. If I set maxZoom below 6 the model doesn't disappear anymore but its location shifts away from the center. |
Is maxzoom 6 used in this video? Could you please also set source's "buffer" to 512? |
@astojilj there was no max zoom in the above video, and we didn't specifically change the source's buffer. Later when we realized that the model was disappearing due to missing maxZoom, we tried different values 4, 6, and 8. With maxZoom 4 and 6 the model was not in the center, more so with value 4. With maxZoom 8 the model was positioned in the center but it would still disappear in certain cases and in rare cases, it shifts away from the center as well. Setting the buffer might prevent the disappearance issue, I will try that. But I am still not sure what's the foolproof way to keep the model always in the center, any ideas? Thanks! |
@astojilj @pjleonard37 We've tried all suggested solutions but unfortunately the model either shifts away from the center or disappears after some time. Do you have any other ideas, or should we wait for the ModelLayer to get stable? FYI, we are animating the model layer over a long distance using modelTranslation while keeping its coordinates the same. Do you think it could be the cause of model disappearance after some time? |
Environment
Observed behavior and steps to reproduce
I encountered an issue where the position of a model in my Mapbox implementation is being inaccurately adjusted for certain coordinates but camera position is fine. The model, which should be centered at specified coordinates, is shifting its position unexpectedly. This behavior occurs despite correct implementation of adding the model, setting camera parameters.
Code for adding model
Code for setting camera:
Expected behavior
Model should appear at the centre like camera
Pictures
The text was updated successfully, but these errors were encountered: