<?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]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=422</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=422&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Marker position.]]></description>
		<lastBuildDate>Sun, 19 Feb 2017 18:22:13 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Marker position]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1852#p1852</link>
			<description><![CDATA[<p>For example in this way:<br /></p><div class="codebox"><pre><code>using UnityEngine;
using Random = UnityEngine.Random;

public class ShowPlayerMarkerOnFront:MonoBehaviour
{
    public int countMarkers = 100;
    public Texture2D playerTexture;

    private Renderer markersRenderer;

    private void Start()
    {
        GenerateMarkers();
        OnlineMapsTileSetControl.instance.OnMeshUpdated += OnMeshUpdated;
    }

    private void OnMeshUpdated()
    {
        if (markersRenderer == null)
        {
            Transform markersTransform = OnlineMaps.instance.transform.FindChild(&quot;Markers&quot;);
            if (markersTransform == null) return;
            markersRenderer = markersTransform.GetComponent&lt;Renderer&gt;();
        }

        Material[] materials = markersRenderer.sharedMaterials;
        for (int i = 0; i &lt; materials.Length; i++)
        {
            Material material = materials[i];
            material.renderQueue = material.shader.renderQueue;
            if (material.mainTexture == playerTexture) material.renderQueue += 1;
        }
    }

    private void GenerateMarkers()
    {
        double tlx, tly, brx, bry;
        OnlineMaps map = OnlineMaps.instance;
        map.GetCorners(out tlx, out tly, out brx, out bry);

        for (int i = 0; i &lt; countMarkers; i++)
        {
            float lng = Random.Range((float)tlx, (float)brx);
            float lat = Random.Range((float)bry, (float)tly);

            map.AddMarker(lng, lat);
        }

        map.AddMarker(map.position, playerTexture, &quot;Player&quot;);
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Sun, 19 Feb 2017 18:22:13 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1852#p1852</guid>
		</item>
		<item>
			<title><![CDATA[Re: Marker position]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1849#p1849</link>
			<description><![CDATA[<p>Thank you Alex; the image is attached now.</p><p>I need to place the last marker (named POI in code below and green in imange), in front of other markers (the blue one), possibly with his label open.</p><p>Thanks!</p>]]></description>
			<author><![CDATA[null@example.com (gribezzo)]]></author>
			<pubDate>Sat, 18 Feb 2017 08:22:14 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1849#p1849</guid>
		</item>
		<item>
			<title><![CDATA[Re: Marker position]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1847#p1847</link>
			<description><![CDATA[<p>Hello.</p><p>Your post does not contain any image.</p><p>For tileset:<br />OnlineMapsTileSetControl.markerComparer<br />Example:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/TilesetMarkerDepthExample.html">http://infinity-code.com/atlas/online-m … ample.html</a></p><p>For others:<br />OnlineMapsBuffer.OnSortMarker<br />Unfortunately, we do not have an example for this.<br />If you need an example, just tell me and I&#039;ll do it.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Fri, 17 Feb 2017 22:50:57 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1847#p1847</guid>
		</item>
		<item>
			<title><![CDATA[Marker position]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1846#p1846</link>
			<description><![CDATA[<p>Hi,</p><p>&nbsp; &nbsp;I use this code to set many PIN markers (blue in the image) on a map ant then just one POI (the green one):</p><p>...<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Set PIN on map<br />&nbsp; &nbsp; &nbsp; &nbsp; for (int i=0; i&lt;PINName.Count; i++) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PINPos.x = float.Parse(PINLon[\i].ToString ());<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PINPos.y = float.Parse(PINLat[\i].ToString ());<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MapLocation = PINName[\i].ToString ();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.AddMarker (PINPos, PINTexture, MapLocation); <br />&nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; // Set POI on map<br />&nbsp; &nbsp; &nbsp; &nbsp; PINPos = new Vector2 (MapLon, MapLat);<br />&nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.zoom = 9;<br />&nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.SetPosition (MapLon, MapLat);<br />&nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.AddMarker (PINPos, MapLocation);<br />...</p><p>There is a way to place la last marker (the green one), in front of the others?<br />Now his position seems random: somethimes is in front, sometimes is behind other markers.</p><p>Thank you!</p>]]></description>
			<author><![CDATA[null@example.com (gribezzo)]]></author>
			<pubDate>Fri, 17 Feb 2017 22:43:17 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1846#p1846</guid>
		</item>
	</channel>
</rss>
