<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Marker Position Changes chaotically after zooming map out]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1352</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1352&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Marker Position Changes chaotically after zooming map out.]]></description>
		<lastBuildDate>Thu, 12 Sep 2019 14:14:20 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Marker Position Changes chaotically after zooming map out]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5525#p5525</link>
			<description><![CDATA[<p>Oh, I think i&#039;ve found a reason why this happens!! I have a navmesh covering 90% of the map and when I move map PlayerMarker moves with it then at some point <span style="color: #FF0000">marker leaves NavMesh</span> and then postions of the marker begins to alterate between actual postion and closest point on the NavMesh!</p>]]></description>
			<author><![CDATA[null@example.com (fedor)]]></author>
			<pubDate>Thu, 12 Sep 2019 14:14:20 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5525#p5525</guid>
		</item>
		<item>
			<title><![CDATA[Re: Marker Position Changes chaotically after zooming map out]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5524#p5524</link>
			<description><![CDATA[<p>Thank you for the swift response! My map width is 4096 and height is 4096. Size in Scene is X: 4096 Y: 4096.</p><p>Regarding active camera : I have set the MapCamera as the Camera for the Map in the inspector and never change this.</p><p>And for second moment : yes, I agree it is better, though mine version works because I have line ( &quot;if (mapCamera.orthographicSize &gt; maxOS) mapCamera.orthographicSize = maxOS;&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (fedor)]]></author>
			<pubDate>Thu, 12 Sep 2019 13:35:04 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5524#p5524</guid>
		</item>
		<item>
			<title><![CDATA[Re: Marker Position Changes chaotically after zooming map out]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5522#p5522</link>
			<description><![CDATA[<p>Hello.</p><p>Typically, chaotic marker movement occurs when you have a map size not equal to N * 256. So first of all, check the size of the map.</p><p>Not relevant to your question, but:</p><p>The first moment that I see here (actually I do not see, but should have seen) is that you change the active camera, but do not set this camera for the map. This can cause unexpected behaviors.<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsControlBase3D.html#a78f46fe747e086154aa8640f5f0e3b76">http://infinity-code.com/doxygen/online … 0f5f0e3b76</a></p><p>The second moment is mapCamera.orthographicSize == maxOS.<br /><a href="https://www.codeproject.com/Articles/383871/Demystify-Csharp-floating-point-equality-and-relat">https://www.codeproject.com/Articles/38 … -and-relat</a><br />It should be something like: Math.Abs (mapCamera.orthographicSize - maxOS) &lt;float.Epsilon.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Thu, 12 Sep 2019 13:14:29 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5522#p5522</guid>
		</item>
		<item>
			<title><![CDATA[Marker Position Changes chaotically after zooming map out]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=5521#p5521</link>
			<description><![CDATA[<p>Hi, I have a problem I don&#039;t know how to fix, i will describe it and hope there is a way to fix it. In the code I create player <br /></p><div class="codebox"><pre><code> playerMarker = OnlineMapsTileSetControl.instance.AddMarker3D(position, playerPrefab); </code></pre></div><p>and I use player camera as the main one. Then at some point I switch to the map view disabling player camera and enabling map camera<br /></p><div class="codebox"><pre><code>     void ActivateMapCamera ()
    {
        playerCamera.depth = 0;
        playerCamera.enabled = false;
        playerCamera.gameObject.SetActive (false);
        initialZoom = OnlineMaps.instance.zoom;
        mapCamera.gameObject.SetActive (true);
        mapCamera.enabled = true;
        mapCamera.depth = 1;
    }</code></pre></div><p>then in script on the mapCamera I have this update function:<br /></p><div class="codebox"><pre><code>    void Update ()
    {
        if (mapControlDisabled)
        {
            if (Input.touchCount == 2)
            {
                OnlineMapsTileSetControl tileSetControl = OnlineMapsTileSetControl.instance;
                tileSetControl.allowUserControl = false;
                Zoom ();
            }
            if (Input.touchCount &lt; 2)
            {
                OnlineMapsTileSetControl tileSetControl = OnlineMapsTileSetControl.instance;
                tileSetControl.allowUserControl = true;
            }
        }
    }</code></pre></div><p>where Zoom() is function which changes mapCamera.orthographicSize. And it contains if-statement which checks if we have zoomed out enough<br /></p><div class="codebox"><pre><code>    void Zoom ()
    {
                ...
        if (mapCamera.orthographicSize == maxOS)
        {
            OnlineMapsTileSetControl tileSetControl = OnlineMapsTileSetControl.instance;
            tileSetControl.allowUserControl = true;
            tileSetControl.allowZoom = true;

            mapControlDisabled = false;
        }
        
        // Change player size to increase visibility on the map
        playerMarker.scale = LerpPlayerScale();
    }</code></pre></div><p>and thats when <span style="color: #FF0000"> problem starts </span>: player postion starts rapidly changing (swapping between two positions: actual one and the wrong one) and further map is zoomed out further apart these positions are. Interesting moment that if I remove (comment) whole if-statement then no problems arise, but I need the functionality to change map zoom in comfortable for the user way. I hope I can find help here.</p><p>P.S. It is code that was written on the 2.5 version of the Online Maps, but I has updated it to the newest version atm which is 3.5 hoping it would fix the problem but no it didn&#039;t.</p>]]></description>
			<author><![CDATA[null@example.com (fedor)]]></author>
			<pubDate>Thu, 12 Sep 2019 12:40:37 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=5521#p5521</guid>
		</item>
	</channel>
</rss>
