<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Marker position]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=422&amp;type=atom" />
	<updated>2017-02-19T18:22:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=422</id>
		<entry>
			<title type="html"><![CDATA[Re: Marker position]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1852#p1852" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-02-19T18:22:13Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1852#p1852</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker position]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1849#p1849" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[gribezzo]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=381</uri>
			</author>
			<updated>2017-02-18T08:22:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1849#p1849</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Marker position]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1847#p1847" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-02-17T22:50:57Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1847#p1847</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Marker position]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1846#p1846" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[gribezzo]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=381</uri>
			</author>
			<updated>2017-02-17T22:43:17Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1846#p1846</id>
		</entry>
</feed>
