Topic: When I zoom in on a map with elevation the map moves

Hi, I try to zoom in on the map while using the elevation of the map but I have the problem that every time I zoom the map rises from the point where I put it without moving the transform

Re: When I zoom in on a map with elevation the map moves

What I want is to be able to zoom without the map moving.
I used the Lock Y scale but the elevation doesn't work out for me and in my project I change location and it breaks

Re: When I zoom in on a map with elevation the map moves

Hi.

This is a planned behavior and happens because the map defaults to a fixed size in the scene.
When you zoom in/out, the displayed distance between map boundaries changes, but the map size in scene is fixed, so the height of the map changes.

Here is an example of how to fix the center point at the same height:

using UnityEngine;

namespace InfinityCode.OnlineMapsSupport
{
    public class KeepCenterAtZero : MonoBehaviour
    {
        private OnlineMaps map;

        private void Start()
        {
            map = OnlineMaps.instance;
            map.OnMapUpdated += OnMapUpdated;
        }

        private void OnMapUpdated()
        {
            double tlx, tly, brx, bry;
            double lng, lat;
            map.GetCorners(out tlx, out tly, out brx, out bry);
            map.GetPosition(out lng, out lat);
            Vector3 worldPosition = OnlineMapsTileSetControl.instance.GetWorldPositionWithElevation(lng, lat, tlx, tly, brx, bry);
            map.transform.Translate(new Vector3(0, -worldPosition.y, 0));
        }
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: When I zoom in on a map with elevation the map moves

Thank you so much