<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Detect tap on a route drawn with Drawing API]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2229&amp;type=atom" />
	<updated>2024-02-08T08:27:59Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2229</id>
		<entry>
			<title type="html"><![CDATA[Re: Detect tap on a route drawn with Drawing API]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9389#p9389" />
			<content type="html"><![CDATA[<p>Hi Alex, oh my, I must have missed this <img src="https://forum.infinity-code.com/img/smilies/lol.png" width="15" height="15" alt="lol" /><br />I actually searched the example atlas for &#039;tap&#039; or &#039;click&#039;, but nothing fitting came up. Thanks for pointing me in the right direction, that is exactly what I need <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[lwRaft]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2901</uri>
			</author>
			<updated>2024-02-08T08:27:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9389#p9389</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Detect tap on a route drawn with Drawing API]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9387#p9387" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Use Drawing Element events.<br />Example:<br /><a href="https://infinity-code.com/atlas/online-maps/pages/DrawingElementEventsExample.html">https://infinity-code.com/atlas/online- … ample.html</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2024-02-07T13:07:54Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9387#p9387</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Detect tap on a route drawn with Drawing API]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9386#p9386" />
			<content type="html"><![CDATA[<p>Addition to my question, I discovered your example for screen coordinate to geographic coordinate conversion.<br />I adapted the script for touch position like this:</p><div class="codebox"><pre><code>using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DetectTapOnRoute : MonoBehaviour
{
    public OnlineMapsControlBase control;

    void Start()
    {
        if (control == null) control = OnlineMapsControlBase.instance;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.touchCount &gt; 0)
        {
            Touch touch = Input.GetTouch(0);
            // Screen coordinate of the touch.
            Vector3 touchPosition = new Vector3(touch.position.x, touch.position.y, 0);

            // Converts the screen coordinates to geographic.
            Vector3 touchGeoLocation = control.GetCoords(touchPosition);

            // Showing geographical coordinates in the console.
            Debug.Log(&quot;touch geo location &quot; + touchGeoLocation);
        }
    }
}</code></pre></div><p>But it doesn&#039;t work reliably yet. Of course, when dragging the map, I get back 0,0,0.</p><p>Unfortunately I also get 0,0,0 most of the time when tapping on random positions on the map.<br />In between, there are some random successful hits with kind of fitting geographic coordinates, but I only get back coordinates (other than 0,0,0) for like 10% of the taps. Any ideas on why it only works for a fraction of my taps?</p>]]></content>
			<author>
				<name><![CDATA[lwRaft]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2901</uri>
			</author>
			<updated>2024-02-07T12:00:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9386#p9386</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Detect tap on a route drawn with Drawing API]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=9385#p9385" />
			<content type="html"><![CDATA[<p>Hi there,</p><p>is there the possibility to detect a tap on mobile (or at least a click) on a route drawn with the Drawing API? I want the user to be able to select one of several drawn routes. </p><p>Thanks in advance.</p>]]></content>
			<author>
				<name><![CDATA[lwRaft]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2901</uri>
			</author>
			<updated>2024-02-07T11:22:45Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=9385#p9385</id>
		</entry>
</feed>
