<?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 — Rotate the camera by compass when online map is sprite render.]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=750</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=750&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Rotate the camera by compass when online map is sprite render..]]></description>
		<lastBuildDate>Wed, 24 Jan 2018 13:46:41 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3265#p3265</link>
			<description><![CDATA[<p>Great!!! Thank you!!!</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Wed, 24 Jan 2018 13:46:41 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3265#p3265</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3264#p3264</link>
			<description><![CDATA[<p>We have slightly improved this method.<br />Now this should work better for you.<br />The next version will contain this.</p><p>OnlineMapsSpriteRendererControl.GetScreenPosition:<br /></p><div class="codebox"><pre><code>public override Vector2 GetScreenPosition(double lng, double lat)
{
    double tlx, tly, brx, bry;
    map.GetTileCorners(out tlx, out tly, out brx, out bry);
    int maxX = 1 &lt;&lt; map.zoom;
    if (tlx &gt; brx) brx += maxX;

    double px, py;
    map.projection.CoordinatesToTile(lng, lat, map.zoom, out px, out py);

    if (px + maxX / 2 &lt; tlx) px += maxX;

    double rx = (px - tlx) / (brx - tlx) - 0.5;
    double ry = 0.5 - (py - tly) / (bry - tly);

    Bounds bounds = spriteRenderer.sprite.bounds;
    Vector3 size = bounds.size;

    rx *= size.x;
    ry *= size.y;

    Vector3 worldPoint = transform.localToWorldMatrix.MultiplyPoint(new Vector3((float)rx, (float)ry, bounds.center.z));
    return Camera.main.WorldToScreenPoint(worldPoint);
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 24 Jan 2018 13:01:32 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3264#p3264</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3256#p3256</link>
			<description><![CDATA[<p>The problem was in that I should remake texture for the map and started work correctly. But now I have a new problem. When markers are behind the screen this function gives me wrong coordinates. I have to draw a polygon on this markers, so when I drag the map and markers change coordinates into the wrong, the polygon has wrong sides.</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Tue, 23 Jan 2018 14:48:48 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3256#p3256</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3244#p3244</link>
			<description><![CDATA[<p>I made a simple script, and it works correctly for me.<br />Please check your script. Maybe it works incorrectly, because in the old version of Online Maps this method did not work correctly?!</p><p>Script:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class LogCoordinatesUnderCursor:MonoBehaviour
{
    private void OnGUI()
    {
        Vector2 coords = OnlineMapsControlBase.instance.GetCoords();

        GUIStyle style = new GUIStyle(GUI.skin.label);
        style.fontSize = 24;
        style.normal.textColor = Color.red;

        GUILayout.Label(&quot;Top Left: &quot; + OnlineMaps.instance.topLeftPosition.ToString(&quot;F6&quot;), style);
        GUILayout.Label(&quot;Bottom Right: &quot; + OnlineMaps.instance.bottomRightPosition.ToString(&quot;F6&quot;), style);
        GUILayout.Label(&quot;Coords: &quot; + coords.ToString(&quot;F6&quot;), style);
        GUILayout.Label(&quot;Input: &quot; + OnlineMapsControlBase.instance.GetInputPosition(), style);
        GUILayout.Label(&quot;Screen Position: &quot; + OnlineMapsControlBase.instance.GetScreenPosition(coords), style);
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 22 Jan 2018 17:50:04 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3244#p3244</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3239#p3239</link>
			<description><![CDATA[<p>Thanks for plugin update! But it looks like OnlineMapsControlBase.instance.GetScreenPosition function gives me wrong data now. I use it for calculation markers coordinates in world space.</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Mon, 22 Jan 2018 13:34:51 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3239#p3239</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3237#p3237</link>
			<description><![CDATA[<p>Great!!! Thanks! Waiting for update.</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Sat, 20 Jan 2018 09:40:33 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3237#p3237</guid>
		</item>
		<item>
			<title><![CDATA[Re: Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3236#p3236</link>
			<description><![CDATA[<p>Hello.</p><p>The problem is fixed.<br />The new version will be available through the built-in update system within two days.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Fri, 19 Jan 2018 20:03:12 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3236#p3236</guid>
		</item>
		<item>
			<title><![CDATA[Rotate the camera by compass when online map is sprite render.]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=3234#p3234</link>
			<description><![CDATA[<p>Is it possible to rotate the camera by the compass when I use sprite render for map and my own system for markers? I was tried to do it, but markers showing in wrong places when I rotate the camera.</p>]]></description>
			<author><![CDATA[null@example.com (drand)]]></author>
			<pubDate>Fri, 19 Jan 2018 09:59:33 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=3234#p3234</guid>
		</item>
	</channel>
</rss>
