mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
722 stars 214 forks source link

Directions problem #1415

Open redagrandrei opened 5 years ago

redagrandrei commented 5 years ago

Hello. So first information about the system.

So im trying to build a map for Android or Windows. Dont really matters at the moment. And in example scene directions are working. but if im trying to use it on a custom map. directions are just some mess. Ill attash some screenshots so you will see. I tried to play with parent\child ierarchy and scale stuff but seems it just doesnt works or im missing something important here. Anyone has some ideas? image image

brnkhy commented 5 years ago

@redagrandrei it's definitely a reference point issue but could be happening in two ways I guess; passing wrong points or positioning output wrong. If you're using DirectionsFactory script, I would suggest creating a few breakpoints, especially on line 80 for example to see which latlng are you passing to the server. I feel like it's the former (passing wrong point) issue but I might be wrong. Also is map scaled/rotated after creating by any chance?

redagrandrei commented 5 years ago

@brnkhy map always has the 1,1,1 scale. But it could be rotated. And from what i see from the example if the map is rotating. DIrections are not working. Is it the intended behaviour ? Also there are some custom ways maybe of drawing a line between 2 Vector2d (lat,lon) points?

redagrandrei commented 5 years ago

@brnkhy checked also waypoints coordinates. Seems that coordinates are ok. Though its drawing some random nonsense anyway.

redagrandrei commented 5 years ago

@brnkhy And one more question. From what i see. Basicaly if i even manage to make directions work on my custom map, i wont be able to zoom it or scale, because directions will break eventually?

redagrandrei commented 5 years ago

@brnkhy im going to TrafficAndDirections example and if i rotate the map DIrections are broken. Whats the sense of the api then if we cant move the map with it?

brnkhy commented 5 years ago

@redagrandrei directions example creates output at root level as a separate object. So if you move/rotate/scale map, which is a totally separate another object, it won't be affected. If you move directions output object under the map object, all those effects will be applied to it as well. You can try it by hand (moving it under map) and if it works. then change the code to make it work like that.

redagrandrei commented 5 years ago

@redagrandrei directions example creates output at root level as a separate object. So if you move/rotate/scale map, which is a totally separate another object, it won't be affected. If you move directions output object under the map object, all those effects will be applied to it as well. You can try it by hand (moving it under map) and if it works. then change the code to make it work like that.

But it's not).If directions are the child of the map. And map is rotated. Directions starting to draw some nonesense anyway. So in some places unity mapbox api is quite useless and lack of documentation not helping. =_=

adikhel commented 4 years ago

We are facing the same problem. Does anyone have any solution to this? Rotating the map breaks the line mesh generated by directionsfactory.