-
Notifications
You must be signed in to change notification settings - Fork 213
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
Transform extension method MoveToGeocoordinate() doesn't work correctly? #60
Comments
Hey @binakot! |
@binakot Try this: private void Update()
{
transform.MoveToGeocoordinate(Latitude, Longitude, MapController.ReferenceTileRect.Center, MapController.WorldScaleFactor);
} @brnkhy Can you shed some light on your future improvements with regards to removing these static references, please? |
@brnkhy @david-rhodes Yes, it works when I pass MapController.ReferenceTileRect.Center and MapController.WorldScaleFactor in my test script. But I got NPE when I initialize objects of my data model on app running. It's not good idea to store it in static values. |
Now, the method accepts additional arguments, such as refPoint and scale. mapbox/mapbox-unity-sdk#60
@binakot static references will be removed soon and but still, you'll have to get the reference point from MapVisualization. In your case, you're simply doing your thing before the world is initialized and some critical properties are calculated/defined. |
Add stupid hotfix with the coroutine. Waiting for MapController ReferenceTileRect value initialization to avoid NPE. mapbox/mapbox-unity-sdk#60
@brnkhy Okay, thanks. Atm I just added stupid coroutine with while loop until MapController will not initialized. And it works. I will add an event logic later probably, or just will wait next SDK release 🍸 Cheers! |
Thanks for this timely issue, @binakot. I ran into the exact same problem when upgrading from SDK 0.4.0 to 0.5.1. Edit: I did a similar hack with TerrainFactory mesh generation complete, because I need to do expensive one-time raycasting to match terrain height, but only when it's loaded. |
Improved: #62 |
It's me again 😈 . Now I can't place objects on the map by their geo coordinates. In earlier version of SDK it worked like a charm, but now it confused me. I'm using version 0.5.1-beta.
For test I created this script:
For example, I set latitude = 55.7481 and longitude = 37.6196. And same values I use in MapController. By idea the object should appear in the center of the generated map. But when I press play button in Unity editor, the object has really wrong position values, smth like (4187795, 0, 7508432).
What do I wrong?
The text was updated successfully, but these errors were encountered: