<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Elevation is wrong]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1122&amp;type=atom" />
	<updated>2019-04-27T14:43:45Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1122</id>
		<entry>
			<title type="html"><![CDATA[Re: Elevation is wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4832#p4832" />
			<content type="html"><![CDATA[<p>Many thanks!<br />Simply using OnlineMapsTileSetControl.instance.GetWorldPositionWithElevation did the job</p>]]></content>
			<author>
				<name><![CDATA[danielesuppo]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=956</uri>
			</author>
			<updated>2019-04-27T14:43:45Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4832#p4832</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation is wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4831#p4831" />
			<content type="html"><![CDATA[<p>This is not my code. This is Thibault code.<br />As I wrote in that post, I modified this method without an IDE, so I did not test it.<br />I missed that wrong parameters are used.<br />Sometimes it happens.</p><p>In your case, I tested it because you wrote that elevations is not working correctly, and found that the wrong parameters are used.<br />You only need to replace one line in this method to make it work.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-04-27T13:08:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4831#p4831</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation is wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4830#p4830" />
			<content type="html"><![CDATA[<p>I&#039;m a bit confused.<br />Actually I think to use &quot;GetUnscaledElevation&quot; in the right way, because the code is:</p><p>...<br /> OnlineMaps.instance.GetCorners(out tlx, out tly, out brx, out bry);<br />...<br />float el = OnlineMapsElevationManagerBase.GetUnscaledElevation(longitude, latitude, tlx, tly, brx, bry);<br />...</p><p>I&#039;ve read your post here<br /><a href="http://forum.infinity-code.com/viewtopic.php?id=1056">http://forum.infinity-code.com/viewtopic.php?id=1056</a><br />and the above code should work.</p><p>I should place my Gameobjects on top of the terrain, just like 3dMarker, based on their Longitude / Latitude.<br />I gave a look to the 3dMarker function to do this, but I could&#039;nt understand the right way...</p>]]></content>
			<author>
				<name><![CDATA[danielesuppo]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=956</uri>
			</author>
			<updated>2019-04-27T12:42:56Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4830#p4830</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation is wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4828#p4828" />
			<content type="html"><![CDATA[<p>Hello.</p><p>GetUnscaledElevation requires a point in the scene relative to the top left corner of the map.<br />The right way:<br /></p><div class="codebox"><pre><code>float el = OnlineMapsElevationManagerBase.GetUnscaledElevation(p.x, p.z, tlx, tly, brx, bry);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-04-27T11:57:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4828#p4828</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Elevation is wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4824#p4824" />
			<content type="html"><![CDATA[<p>Hello,<br />I should put some Gameobjects at real positions, longitude, latitude and altitude (in meters).</p><p>To do this, I&#039;m using your suggested code:</p><p> public static Vector3 GetWorldPositionWithAltitude(double longitude, double latitude, float elevation)<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; double tlx, tly, brx, bry;<br />&nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps.instance.GetCorners(out tlx, out tly, out brx, out bry);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; Vector3 p = OnlineMapsTileSetControl.instance.GetWorldPositionWithElevation(longitude, latitude, tlx, tly, brx, bry);<br />&nbsp; &nbsp; &nbsp; &nbsp; float el = OnlineMapsElevationManagerBase.GetUnscaledElevation(longitude, latitude, tlx, tly, brx, bry);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; float yOff = elevation - el;<br />&nbsp; &nbsp; &nbsp; &nbsp; yOff *= OnlineMapsElevationManagerBase.GetBestElevationYScale(tlx, tly, brx, bry);<br />&nbsp; &nbsp; &nbsp; &nbsp; yOff *= OnlineMaps.instance.transform.localScale.x;<br />&nbsp; &nbsp; &nbsp; &nbsp; p.y += yOff;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; return p;<br />&nbsp; &nbsp; }</p><p>Unfortunately the Gameobjects seem to be placed at a wrong height: someone is more or less right (on the surface), but most of them are a lot under or over the surface.<br />I&#039;ve tried with Mapbox, ArcGis and Bing elevation, but with all of them I get the same result.</p><p>I&#039;d be glad for your help!<br />Thanks!</p>]]></content>
			<author>
				<name><![CDATA[danielesuppo]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=956</uri>
			</author>
			<updated>2019-04-27T00:29:51Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4824#p4824</id>
		</entry>
</feed>
