mapbox-unity-sdk icon indicating copy to clipboard operation
mapbox-unity-sdk copied to clipboard

How to set-up a responsive relationship between Camera Zoom Level, Tile Provider & Prefab Size?

Open StarKing777 opened this issue 7 years ago • 3 comments

Hi Mapbox team and fellow Git users,

I just wanna start off by saying I absolutely love the product and all the solutions it comes with as it is really helping me bring my vision to life and that honestly means the world to me.

I generally try research as much as possible before I ever have to resort to opening an issue in this case I spent the whole day trying figure out the following use case:

  • I have successfully managed to instantiate objects in play mode and place them onto the map by converting my mouse pointers longlat to Mapbox Vector3 space.

However I would still like to figure out the following:

  • How do I prevent the abstract maps tile provider from needing to increase instantiated tile numbers as my main camera zooms away from map. (map zoom level starts at 16, as I zoom the camera out, the map zoom level stays at 16 and tiles numbers increase and subsequently take longer to load).

  • How do I create a relationship between camera zoom and tile provider so that as camera zooms out and reaches a certain level, my tile provider then updates?

  • In the event that I can successfully prevent my application from needing to load more tiles in order to zoom out, will this then affect my placed prefabs size and position within the originally converted and placed Mapbox Vector3 space? (I would like to insure that my prefabs stay at the originally set Mapbox Vector3 scale).

  • How would I go about getting certain selected prefabs to increase in scale dependent on the zoomed out zoom level of the abstract map? (as the map zooms out I would like certain selected prefabs to increase in scale and not stay fixed at a relative scale).

I hope this isn't asking too much but I know that you guys know more than me when it comes to the possibility in guiding me in a relevant direction.

I will continue my research in order to continue trying to figure this out by myself but I would really, really appreciate any assistance and guidance on these issues and queries.

thanks again.

Kind regards,

Jesse

StarKing777 avatar Oct 15 '19 15:10 StarKing777

Hello @StarKing777 ! Thanks a lot for your kind words, made me very happy to hear you like it!

How do I prevent the abstract maps tile provider from needing to increase instantiated tile numbers as my main camera zooms away from map. (map zoom level starts at 16, as I zoom the camera out, the map zoom level stays at 16 and tiles numbers increase and subsequently take longer to load). I think you're using camera bounds setting and moving camera away so the system is trying to fill the area with tiles. Have you tried quad tree stuff (zoomable map demo scene) and/or Range around center/transform settings for tile provider? Either of those shouldn't increase tile count too much.

How do I create a relationship between camera zoom and tile provider so that as camera zooms out and reaches a certain level, my tile provider then updates? isn't this the same behaviour we have in zoomable map demo scene? Or do I understand it wrong?

In the event that I can successfully prevent my application from needing to load more tiles in order to zoom out, will this then affect my placed prefabs size and position within the originally converted and placed Mapbox Vector3 space? (I would like to insure that my prefabs stay at the originally set Mapbox Vector3 scale). I think spawned object sizes won't stay same relative to map when you change zoom level and I'm afraid I can't think of an eacy solution to that on top of my head. I think we do something similar in prefab modifier with a scaling option there. You might need to do a scaling similar to that.

How would I go about getting certain selected prefabs to increase in scale dependent on the zoomed out zoom level of the abstract map? (as the map zooms out I would like certain selected prefabs to increase in scale and not stay fixed at a relative scale). Same as previous I guess? keep track of spawned objects, track zoom level of abstract map, scale them on zoom level change. I think I haven't done that before myself either but that would be how I start looking into it. Hope that helps!

brnkhy avatar Nov 18 '19 17:11 brnkhy

Hey man, thanks a lot for the reply really appreciate the guidance and assistance.

I am using abstract map and I find that when I zoom out the tile size stays the same, I am worried that this will use way too much data, I will try range around center / transform as I am assuming that this will update with the camera's center position

  • How do I prevent the abstract maps tile provider from needing to increase instantiated tile numbers as my main camera zooms away from map. (map zoom level starts at 16, as I zoom the camera out, the map zoom level stays at 16 and tiles numbers increase and subsequently take longer to load).

  • I think you're using camera bounds setting and moving camera away so the system is trying to fill the area with tiles. Have you tried quad tree stuff (zoomable map demo scene) and/or Range around center/transform settings for tile provider? Either of those shouldn't increase tile count too much.

I am avoiding the zoomable map as I find that it has limitations when it comes to allowing prefabs to be placed, abstract map seems to have a far smoother experience when it comes to placing prefabs in the Vector3 space

  • How do I create a relationship between camera zoom and tile provider so that as camera zooms out and reaches a certain level, my tile provider then updates?

  • isn't this the same behaviour we have in zoomable map demo scene? Or do I understand it wrong?

Thanks for the rest of the advice, I will run through everything and give my feedback once I have investigated all of your suggested solutions.

Thanks again!

StarKing777 avatar Nov 19 '19 07:11 StarKing777

@StarKing777 I know zoomable map can be a little harder to work with as whole map move and gets scaled up&down but I think it'll still be better option as it supports map zoom levels (not camera zoom) by default. Hope it works out well! Closing this for now, feel free to reopen it any time!

brnkhy avatar Nov 25 '19 09:11 brnkhy