<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — OnlineMaps.SetPosition not working correctly.]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=439&amp;type=atom" />
	<updated>2017-03-02T06:47:12Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=439</id>
		<entry>
			<title type="html"><![CDATA[Re: OnlineMaps.SetPosition not working correctly.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1918#p1918" />
			<content type="html"><![CDATA[<p>In this case, it makes sense.<br />Online Maps checks map boundary and corrects the latitude, if the top or bottom latitude is outside (90, -90).</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-02T06:47:12Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1918#p1918</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: OnlineMaps.SetPosition not working correctly.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1915#p1915" />
			<content type="html"><![CDATA[<p>The problem seems to be coming from line 1728 (or close to) in SetPosition: </p><p>if (modified) projection.TileToCoordinates(tpx, tpy, _zoom, out lng, out lat);</p><p>before this method, lat is set to the coordinate, afterwards it is set to zero.</p><p>EDIT:<br />Some more information, as what&#039;s inside that function suggests it&#039;s a math issue: The zoom is set to three (before I set the zoom). The pixel size of the map is 2048x2048. The scene size of the map is 1024x1024.</p><p>EDIT:<br />Setting the zoom before I set the position solves the issue. Seems to be caused by the latitude being clamped to 0 at that zoom level (3).</p>]]></content>
			<author>
				<name><![CDATA[nug700]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=378</uri>
			</author>
			<updated>2017-03-01T21:23:15Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1915#p1915</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: OnlineMaps.SetPosition not working correctly.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1914#p1914" />
			<content type="html"><![CDATA[<p>I created that LatLng (Location) struct, and the tostring method uses those fields: </p><p>return string.Format(&quot;(Lat: {0}, Lng: {1})&quot;, Latitude, Longitude);</p><p>So the field is being set.</p><p>I did try your idea: &quot;Loading at location: -112.4193 34.62115&quot;</p><p>I&#039;ve also put a Log call inside SetPosition: &quot;OnlineMaps.SetPosition: -112.42015838623 34.6255073547363&quot;<br />To show that the values are being passed correctly.</p>]]></content>
			<author>
				<name><![CDATA[nug700]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=378</uri>
			</author>
			<updated>2017-03-01T21:11:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1914#p1914</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: OnlineMaps.SetPosition not working correctly.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1910#p1910" />
			<content type="html"><![CDATA[<p>Hello.</p><p>I tested this method in «SceneManager.sceneLoaded», and it works well.<br />Actually, this method is used in many internal methods, and if it has problem, it be appears a long time ago.<br />I was very confused that the problem is only in the latitude.<br />Try it this way:<br />Debug.Log ( &quot;Loading at location: &quot; + Location.Longitude + &quot;&nbsp; &nbsp;&quot; + Location.Latitude);<br />Perhaps, somehow, this field is not set.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-03-01T08:30:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1910#p1910</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[OnlineMaps.SetPosition not working correctly.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1909#p1909" />
			<content type="html"><![CDATA[<p>For some reason, OnlineMaps.SetPosition is not setting the latitude to the new value provided, while the longitude is. </p><p>In this example: </p><p>&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&quot;Loading at location: &quot; + Location);<br />&nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.SetPosition(Location.Longitude, Location.Latitude);<br />&nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.zoom = zoom;<br />&nbsp; &nbsp; &nbsp; &nbsp; Debug.Log(&quot;New location: &quot; + OnlineMaps.instance.position);</p><p>I get this in the log:<br />- Loading at location: (Lat: 34.62605, Lng: -112.418)<br />- New location: (-112.3, 0.0)</p><br /><br /><p>This is called from the SceneManager.sceneLoaded event.</p>]]></content>
			<author>
				<name><![CDATA[nug700]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=378</uri>
			</author>
			<updated>2017-03-01T01:51:38Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1909#p1909</id>
		</entry>
</feed>
