Topic: Map shake a little with SetPosition

Hello, I'm moving the map very slowly from a longitude latitude point to another,
with a simple Lerp:

Vector2 newMapPos = Vector2.Lerp(pos1,pos2, t);
double longitude = newMapPos.x;
double latitude = newMapPos.y;
OnlineMaps.instance.SetPosition(longitude, latitude);

The map is very zoomed, and I can see that it "shake" a little.
Obviously with a lower zoom is much less noticeable.

Am I doing something wrong or it is normal?
Many thanks

Re: Map shake a little with SetPosition

Hello.

Here are two problems:
1. Vector2 is based on float, and it just doesn't have enough accuracy on a large zoom.
Use doubles or OnlineMapsVector2d instead of Vector2.
OnlineMapsVector2d also has a Lerp method.
2. Use Lerp for coordinates is not correct, because the coordinates exist on the sphere, and the map is displayed on the plane (has a Mercator projection).
For a larger zoom you probably will not see this problem.
But for small zoom it will be very noticeable.
The correct way is Lerp tile position.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Map shake a little with SetPosition

Many thanks, I'll try as you suggested

Re: Map shake a little with SetPosition

It work perfectly. Thank-you!