<?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 — Find direction of geographic location relative to heading.]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=243</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=243&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Find direction of geographic location relative to heading..]]></description>
		<lastBuildDate>Tue, 21 Feb 2017 11:44:26 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Find direction of geographic location relative to heading.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1866#p1866</link>
			<description><![CDATA[<p>Hello.</p><p>What is «root path of two different location»?<br />Is a route between two locations, or something else?</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 21 Feb 2017 11:44:26 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1866#p1866</guid>
		</item>
		<item>
			<title><![CDATA[Re: Find direction of geographic location relative to heading.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1863#p1863</link>
			<description><![CDATA[<p>hello please help me ,<br />How can i find my root path of two different location ?<br />i&#039;hv go through the code ,but i can get it in last two days.</p><p>Thanks in advance</p>]]></description>
			<author><![CDATA[null@example.com (if.testingacc)]]></author>
			<pubDate>Tue, 21 Feb 2017 05:47:56 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1863#p1863</guid>
		</item>
		<item>
			<title><![CDATA[Re: Find direction of geographic location relative to heading.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1088#p1088</link>
			<description><![CDATA[<p>Hello.</p><p>Something like that:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class GetPointHeading:MonoBehaviour
{
    private OnlineMaps map;
    private float trueHeading;

    private void Start()
    {
        map = OnlineMaps.instance;
 
        OnlineMapsControlBase.instance.OnMapClick += OnMapClick;
        OnlineMapsLocationService.instance.OnCompassChanged += OnCompassChanged;
    }

    private void OnCompassChanged(float f)
    {
        trueHeading = f * 360;
    }

    private void OnMapClick()
    {
        double mx, my, px, py;
        map.GetPosition(out mx, out my);
        OnlineMapsControlBase.instance.GetCoords(out px, out py);

        // Online Maps v2.4 way:
        map.projection.CoordinatesToTile(mx, my, map.zoom, out mx, out my);
        map.projection.CoordinatesToTile(px, py, map.zoom, out px, out py);

        // Online Maps v2.3 way:
        // OnlineMapsUtils.LatLongToTiled(mx, my, map.zoom, out mx, out my);
        // OnlineMapsUtils.LatLongToTiled(px, py, map.zoom, out px, out py);

        // 0 - North, 90 - East, 180 - South, 270 (in this case, the following number is -89) - West
        float heading = (float)OnlineMapsUtils.Angle2D(mx, my, px, py) + 90;

        float relativeHeading = heading - trueHeading;
        if (relativeHeading &lt; -180) relativeHeading += 360;
        else if (relativeHeading &gt; 180) relativeHeading -= 360;

        Debug.Log(&quot;Heading: &quot; + heading + &quot;, True Heading: &quot; + trueHeading + &quot;, Relative Heading: &quot; + relativeHeading);
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 10 Aug 2016 19:52:49 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1088#p1088</guid>
		</item>
		<item>
			<title><![CDATA[Find direction of geographic location relative to heading.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1086#p1086</link>
			<description><![CDATA[<p>Hi,</p><p>How would I calculate the direction of a geographic lat/lon position, relative to the current heading / compass value?</p><p>Ie, if we’re facing East (trueHeading = 90.0) then a point to the east would have a bearing of 0 (ie, we&#039;re pointing directly at it), a point directly South would have a bearing 90 and I guess something to the North would have a bearing of -90 (or 270?)</p><p>Basically I want to be able to show if we’re ‘facing’ a certain point (The closer to zero, the more we’re facing it. 180 means we’re facing directly away from it)</p><p>Hope that makes sense!</p>]]></description>
			<author><![CDATA[null@example.com (petejw)]]></author>
			<pubDate>Wed, 10 Aug 2016 19:09:33 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1086#p1086</guid>
		</item>
	</channel>
</rss>
