Comments (7)
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.
from mapbox-unity-sdk.
Hey @binakot!
It actually works but the problem is, it puts the object relative to the origin of the mercator projection system. So that lat/lng is most likely around those value (in meters) but the problem is, your world, or let's say your current tiles, are not.
Mesh generation stuff builds everything in relative position to prevent those huge numbers, so what you have to do there is to pass the position of you central tile instead of Vector2.zero in that call. I believe MapController class has the central tile reference in the current version so it should work if you simply use ReferenceTileRect.Center
there.
from mapbox-unity-sdk.
@binakot MoveToGeocoordinate
has been decoupled from MapController
. Now, the method accepts additional arguments, such as refPoint
and scale
. For accurate placement, you need to pass these parameters in.
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?
from mapbox-unity-sdk.
@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.
from mapbox-unity-sdk.
@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.
What we'll do though, is to create an event inside MapVisualization and then you'll be able to trigger your stuff to that event easily. Actually you can do that with the MapController class at the moment as well, just add an event and fire it right after ReferenceTile is set etc. That would solve your issue for now.
from mapbox-unity-sdk.
@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!
from mapbox-unity-sdk.
Improved: #62
from mapbox-unity-sdk.
Related Issues (20)
- The 3D models on the map change their position when locating is activated.
- Setting the Map Extent Options to CameraBounds at runtime doesn't work HOT 1
- Spawn prefabs upwards with a fixed gap
- why only mapbox street v7 can edit POI prefab
- Mapbox + Unity Cloud Build
- Error: Cannot Initialize non-default texture with negative or zero width HOT 1
- suddort URP ? HOT 2
- How to Apply Texture to Tiles
- Swapped North/South and West/East coordinates in Tile Id To Bounds?
- This project is dead? HOT 12
- Your hardware does not support this application. Failed to load 'libmain.so' java.lang.UnsatisfiedLinkError: dopen failed: library "libmain.so" not found HOT 1
- Can I make changes to AbstractMap's Features?
- Can I make changes to AbstractMap's Map Layers Tileset ID via code during runtime?
- heatmap rendering issue
- Meta Quest 3 Build Issues
- Some Building Meshes get "cutoff"
- Mapbox building:levels property support of Unity SDK HOT 3
- language support for raster tile
- Unity - Mapbox environment "Profiles"
- Not compatible with Unity 6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapbox-unity-sdk.