<?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 — Get new Lat/Lng after marker drag]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=643</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=643&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Get new Lat/Lng after marker drag.]]></description>
		<lastBuildDate>Fri, 08 Sep 2017 22:39:04 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Get new Lat/Lng after marker drag]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2770#p2770</link>
			<description><![CDATA[<p>Great Thanks!&nbsp; My issue was as I was logging it to the console I was using Debug.Log(playerMarker.position); and it was only logging the Vector2 to only 1 decimal place.<br />Thanks again for clearing this up.</p>]]></description>
			<author><![CDATA[null@example.com (andyhast81)]]></author>
			<pubDate>Fri, 08 Sep 2017 22:39:04 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2770#p2770</guid>
		</item>
		<item>
			<title><![CDATA[Re: Get new Lat/Lng after marker drag]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2769#p2769</link>
			<description><![CDATA[<p>Hello.</p><p>I tested your code, and it works correctly.<br />The coordinates of the marker is changes.<br />Most likely, you just do not see a change because Vector2.ToString shows only one decimal point.<br />Use:<br />Debug.Log(playerMarker.position.ToString(&quot;F4&quot;));<br />or<br />Debug.Log(playerMarker.position.x + &quot;&nbsp; &nbsp;&quot; + playerMarker.position.y);</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Fri, 08 Sep 2017 02:28:56 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2769#p2769</guid>
		</item>
		<item>
			<title><![CDATA[Get new Lat/Lng after marker drag]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=2768#p2768</link>
			<description><![CDATA[<p>Hello,</p><p>I&#039;m trying to allow the user to edit their location that is created by the OnlineMapsLocationService.&nbsp; If the user thinks the marker should be in a different spot they can long press then drag the marker.</p><p>Everything is working except when trying to get the new lat/lng OnMarkerRelease, it always shows the same coordinates no matter how far away I drag the marker.&nbsp; Any help on getting the new lat/lng after dragging the marker would be great.&nbsp; My code is below.</p><div class="codebox"><pre><code>public class GetCurrentLocation : MonoBehaviour{

  private OnlineMapsMarker playerMarker;
    
    private void Start(){
        // Create a new marker.
    playerMarker = OnlineMaps.instance.AddMarker(new Vector2(0, 0), null, &quot;marker&quot;);
        if (locationService == null){
        Debug.LogError(
            &quot;Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).&quot;);
                return;
        }

        // Subscribe to the change location event.
        locationService.OnLocationChanged += OnLocationChanged;

        playerMarker.OnLongPress += OnMarkerLongPress;
        playerMarker.OnRelease += OnMarkerRelease;

    }

// When the location has changed
    private void OnLocationChanged(Vector2 position){
    // Change the position of the marker.
    
    // Redraw map.
    OnlineMaps.instance.Redraw();
    }

    private void OnMarkerLongPress(OnlineMapsMarkerBase playerMarker){
    // Starts moving the marker.
    OnlineMapsControlBase.instance.dragMarker = playerMarker;
    OnlineMapsControlBase.instance.isMapDrag = false;
    }

    private void OnMarkerRelease(OnlineMapsMarkerBase playerMarker){
        
    Debug.Log (playerMarker.position);

    }

}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (andyhast81)]]></author>
			<pubDate>Fri, 08 Sep 2017 02:08:43 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=2768#p2768</guid>
		</item>
	</channel>
</rss>
