<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Collision between markers]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=273&amp;type=atom" />
	<updated>2016-09-09T21:50:49Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=273</id>
		<entry>
			<title type="html"><![CDATA[Re: Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1230#p1230" />
			<content type="html"><![CDATA[<p>Create your own marker system, for example using uGUI, and you&#039;ll have a separate markers and map.<br />Example:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/uGUICustomMarkerEngineExample.html">http://infinity-code.com/atlas/online-m … ample.html</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-09-09T21:50:49Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1230#p1230</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1229#p1229" />
			<content type="html"><![CDATA[<p>Thank you i will try that.</p><p>Otherwise is there a controller who can draw markers apart from the map texture ?</p>]]></content>
			<author>
				<name><![CDATA[y.mantegues]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=253</uri>
			</author>
			<updated>2016-09-09T15:13:57Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1229#p1229</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1228#p1228" />
			<content type="html"><![CDATA[<p>I forgot to write:<br />Actually you can use boxcollider2D, but you need to update colliders position manually to make it work.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-09-09T15:04:13Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1228#p1228</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1227#p1227" />
			<content type="html"><![CDATA[<p>When you use GUI Texture Control, markers drawn directly into map texture, so you can not use boxcollider2D.</p><p>Example of how to detect collision of markers (without the colliders):<br /></p><div class="codebox"><pre><code>using System.Linq;
using UnityEngine;

public class DetectMarkersCollision:MonoBehaviour
{
    private void Update()
    {
        CheckMarkersCollision();
    }

    private void CheckMarkersCollision()
    {
        OnlineMapsMarker[] markers = OnlineMaps.instance.markers;
        if (markers.Length &lt; 2) return;

        Rect[] rects = markers.Select(m =&gt; m.screenRect).ToArray();

        for (int i = 0; i &lt; rects.Length - 1; i++)
        {
            Rect rect1 = rects[i];
            for (int j = i + 1; j &lt; rects.Length; j++)
            {
                Rect rect2 = rects[j];
                if (rect1.Overlaps(rect2)) OnCollisionDetected(markers[i], markers[j], i, j);
            }
        }
    }

    private void OnCollisionDetected(OnlineMapsMarker marker1, OnlineMapsMarker marker2, int index1, int index2)
    {
        Debug.Log(&quot;Collision detected between &quot; + index1 + &quot; and &quot; + index2);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-09-09T15:00:07Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1227#p1227</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1226#p1226" />
			<content type="html"><![CDATA[<p>Sorry english is not my native language ...<br />I use GUI Texture Control, with the built-in marker system.<br />I just want to remove the marker when it collide, so I just want to detect the collision</p><p>Thank you for your fast response</p>]]></content>
			<author>
				<name><![CDATA[y.mantegues]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=253</uri>
			</author>
			<updated>2016-09-09T14:38:11Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1226#p1226</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1225#p1225" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Your question looks very simple, but, unfortunately, I did not understand anything, except that you want to detect the collision markers.<br />What control do you use?<br />You use built-in or your own marker system?<br />What should happen when the markers are collided?<br />You just want to detect the collision, or to make the markers do not intersect?</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-09-09T14:32:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1225#p1225</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Collision between markers]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1224#p1224" />
			<content type="html"><![CDATA[<p>Hello,<br />I want to make 2 markers collide between them when one move close enough to the other.<br />But when the moving marker move, the collider don&#039;t follow and stay at the origin point. I use boxcollider2D.</p><p>Since it&#039;s not possible to my knowledge to use sprite on the map (they are created &quot;under&quot; the map), this is the only way I find to have moving elements on my map, maybe it&#039;s not the best way to do that ?</p><p>Thanks for help</p>]]></content>
			<author>
				<name><![CDATA[y.mantegues]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=253</uri>
			</author>
			<updated>2016-09-09T14:17:19Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1224#p1224</id>
		</entry>
</feed>
