<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Update multiple positions on maps]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1157&amp;type=atom" />
	<updated>2019-05-12T10:07:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1157</id>
		<entry>
			<title type="html"><![CDATA[Re: Update multiple positions on maps]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4926#p4926" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Theoretically, you can greatly optimize calculations in this way:<br />1. Calculate the coordinates of the borders of your GameObject (find the top-left coordinate and bottom-right coordinate).<br />2. When OnChangeZoom and OnChangePosition, find the tile position and unity world position of your corners.<br />3. Convert the coordinates of each GameObject to a tile position, find the relative tile position of the GameObject and, based on this, find the unity world position of GameObject.<br />4. If the GameObject is inside the map view, get elevation.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-05-12T10:07:39Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4926#p4926</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Update multiple positions on maps]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4923#p4923" />
			<content type="html"><![CDATA[<p>Hello,<br />I have hundreds of childGameobjects placed on my map.<br />All of them are parented to a rootGameobject.</p><p>The root.position is (0,0,0), the root.localScale is (1,1,1),<br />and I initialize them with &quot;GetWorldPositionWithElevation&quot;, because I know their real longitude/latitude.</p><p>When I pan or zoom the map I&#039;d like their positions to be updated, but if I call &quot;GetWorldPositionWithElevation&quot; for each of them on &quot;OnChangeZoom&quot; and &quot;OnChangePosition&quot; events&nbsp; I have a huge performance issue.</p><p>I can translate my rootGameobject on the basis of the map translation (OnlineMaps.position), but the translation combined with the map zoom is giving to me a lot of struggles.</p><p>Is there a &quot;right&quot; way&nbsp; to update the position of all my gameobjetcs in one go, on the basis of map translation and map zoom, in reference to a root transform?</p><p>Many thanks!</p>]]></content>
			<author>
				<name><![CDATA[danielesuppo]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=956</uri>
			</author>
			<updated>2019-05-11T20:40:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4923#p4923</id>
		</entry>
</feed>
