Topic: Problem when zooming and panning the map at the same time
Hello,
if I zoom the map with a Lerp let's say from 10 to 14, and at the same time I move in the same Lerp the map (just a couple of Km) the Latitude and Longitude go crazy...
Just lerping the zoom, or the pan, is ok.
This is my code
while (Time.time - tm <= time)
{
float t = (Time.time - tm) / time;
///Get end tile map position
OnlineMapsVector2d endPos = GetTilePosition(placeholder);
///Lerp final position
OnlineMapsVector2d pos = OnlineMapsVector2d.Lerp(initPos, endPos, t);
OnlineMaps.instance.SetTilePosition(pos.x, pos.y);
///If the actual map zoom level is less than the
///default zoom level, zoom in the map
if (OnlineMaps.instance.floatZoom < defaultMapZoom)
{
OnlineMaps.instance.floatZoom = Mathf.Lerp(OnlineMaps.instance.floatZoom, GameManager.defaultMapZoom, t);
}
yield return null;
}
private OnlineMapsVector2d GetTilePosition(Transform target)
{
OnlineMapsVector2d pos = new OnlineMapsVector2d();
if (OnlineMapsTileSetControl.instance.GetCoordsByWorldPosition
(out double lon, out double lat, target.position))
{
OnlineMaps.instance.projection.CoordinatesToTile
(lon, lat, OnlineMaps.instance.zoom, out double endPosX, out double endPosY);
pos.x = endPosX;
pos.y = endPosY;
}
return pos;
}