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

Weird panning behaviour when using quad tree camera movement

Open jpienbroapollojourney opened this issue 7 years ago • 5 comments

Unity version: 2018.3.7 Mapbox version: 2.0.0

When trying to pan using the QuadTreeCameraMovement it's really weird, not the movement on the map that you would except, compared to Google Maps pan behaviour and your the live demo on your webpage: https://api.mapbox.com/styles/v1/mapbox/streets-v9.html?title=true&access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA#4.57/10.49/9.11

I managed to improve it a bit by changed the panning speed to 2.5, but this only fixes it for horizontal movement, for vertical movement it will really act strange then. Basically I would expect that when you drag with a mouse/finger that the location on the map when the press event started would stay under your mouse of finger when dragging. In other words move at the same rate as the mouse/finger moves.

Your live web demo as mentioned before does this correctly, but not in the Unity SDK. This weird behaviour is noticeable in the example scene "ZoomableMap" in your Unity SDK.

jpienbroapollojourney avatar Mar 07 '19 15:03 jpienbroapollojourney

Hello @jpienbroapollojourney, As you noted, camera work can definitely use some improvements. Admittedly, it's not very polished at the moment. I believe the most straight forward solution to this, is to raycast and update camera movement using the position difference of the raycast result. At least I used that in this webgl demo project, http://barankahyaoglu.com/map/beta.html. Can you check and verify if it's better in that demo so I'll know I understand the issue correct?

brnkhy avatar Mar 19 '19 03:03 brnkhy

Yes, that WebGL demo works much better

jpienbroapollojourney avatar Mar 19 '19 07:03 jpienbroapollojourney

I'm working on a similar camera script, but I found that yours works way much better @brnkhy. I'll just put this here so that I could be updated on this matter

https://gist.github.com/danylaksono/983dddfde0395ff35a8f24b0e8c3b0b4

danylaksono avatar Mar 29 '19 16:03 danylaksono

Hello @jpienbroapollojourney, As you noted, camera work can definitely use some improvements. Admittedly, it's not very polished at the moment. I believe the most straight forward solution to this, is to raycast and update camera movement using the position difference of the raycast result. At least I used that in this webgl demo project, http://barankahyaoglu.com/map/beta.html. Can you check and verify if it's better in that demo so I'll know I understand the issue correct?

Hey buddy, is the code available to this project of yours I am trying to get my camera to rotate but the quad tree camera movement seems to be a bit impractical for what it is that I am trying to do.

Kind regards,

Jesse

StarKing777 avatar Oct 10 '19 14:10 StarKing777

Just a heads up. For me, vertical panning didn't work smoothly in the Unity editor, but once I deployed to my iPhone the problem was gone, so the issue might be native to the editor.

baris-cincik avatar Jan 20 '20 18:01 baris-cincik