<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Marker Position Changes chaotically after zooming map out]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1352&amp;type=atom" />
	<updated>2019-09-12T14:14:20Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1352</id>
		<entry>
			<title type="html"><![CDATA[Re: Marker Position Changes chaotically after zooming map out]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5525#p5525" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[fedor]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1102</uri>
			</author>
			<updated>2019-09-12T14:14:20Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5525#p5525</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker Position Changes chaotically after zooming map out]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5524#p5524" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[fedor]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1102</uri>
			</author>
			<updated>2019-09-12T13:35:04Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5524#p5524</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker Position Changes chaotically after zooming map out]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5522#p5522" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-09-12T13:14:29Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5522#p5522</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Marker Position Changes chaotically after zooming map out]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5521#p5521" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[fedor]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1102</uri>
			</author>
			<updated>2019-09-12T12:40:37Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5521#p5521</id>
		</entry>
</feed>
