<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — When I zoom in on a map with elevation the map moves]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2113&amp;type=atom" />
	<updated>2023-04-26T14:31:35Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2113</id>
		<entry>
			<title type="html"><![CDATA[Re: When I zoom in on a map with elevation the map moves]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9008#p9008" />
			<content type="html"><![CDATA[<p>Thank you so much</p>]]></content>
			<author>
				<name><![CDATA[jose]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2589</uri>
			</author>
			<updated>2023-04-26T14:31:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9008#p9008</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: When I zoom in on a map with elevation the map moves]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9007#p9007" />
			<content type="html"><![CDATA[<p>Hi.</p><p>This is a planned behavior and happens because the map defaults to a fixed size in the scene.<br />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.</p><p>Here is an example of how to fix the center point at the same height:<br /></p><div class="codebox"><pre><code>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));
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2023-04-26T13:26:10Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9007#p9007</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: When I zoom in on a map with elevation the map moves]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9006#p9006" />
			<content type="html"><![CDATA[<p>What I want is to be able to zoom without the map moving.<br />I used the Lock Y scale but the elevation doesn&#039;t work out for me and in my project I change location and it breaks</p>]]></content>
			<author>
				<name><![CDATA[jose]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2589</uri>
			</author>
			<updated>2023-04-26T12:28:07Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9006#p9006</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[When I zoom in on a map with elevation the map moves]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9005#p9005" />
			<content type="html"><![CDATA[<p>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</p>]]></content>
			<author>
				<name><![CDATA[jose]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2589</uri>
			</author>
			<updated>2023-04-26T12:25:01Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9005#p9005</id>
		</entry>
</feed>
