<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Request/Load/Create Buildings]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=59&amp;type=atom" />
	<updated>2015-12-03T00:48:44Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=59</id>
		<entry>
			<title type="html"><![CDATA[Re: Request/Load/Create Buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=238#p238" />
			<content type="html"><![CDATA[<p>Hello.</p><p>In Online Maps v2.3 beta, we have added a few API, which is will help control the buildings:<br />1. <strong>OnlineMapsBuildings.maxBuilding</strong> - The maximum number of buildings.<br />2. <strong>OnlineMapsBuildings.maxActiveBuildings</strong> - The maximum number of active (visible) buildings.<br />3. <strong>OnlineMapsBuildings.OnCreateBuilding</strong> - This event is triggered before create a building. <br />Return TRUE - if you want to create this building, FALSE - avoid creating this building.<br />4. <strong>OnlineMapsBuildings.OnPrepareRequest</strong> - This event is called when creating a request to OSM Overpass API. <br />This is useful if you want to limit / expand request. For example, you want to get information only on some types of buildings.</p><p>Example of using attached.</p><p>Please update Online Maps through the built-in update (Component / Infinity Code / Online Maps / Check Updates) to the latest beta version.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2015-12-03T00:48:44Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=238#p238</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Request/Load/Create Buildings]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=237#p237" />
			<content type="html"><![CDATA[<p>Hi,</p><p>I&#039;d like to limit the number of OSM buildings according to the distance between the building and a player on the ground.<br />The buildings should dynamically be loaded and disposed when the player moves. </p><p>I did a first naive implementation by altering a line in the OnlineMapsBuildings script:</p><div class="codebox"><pre><code>building = OnlineMapsBuildingBuiltIn.Create(this, data.way, data.nodes);

if (building != null &amp;&amp; Vector3.Distance(Player.transform.position, building.transform.position) &lt; 200)
{
    building.LoadMeta(data.way);
    if (OnBuildingCreated != null) OnBuildingCreated(building);
    unusedBuildings.Add(data.way.id, building);
}</code></pre></div><p>But I&#039;d like to ask how I can make such a functionality work the &quot;proper&quot; way.&nbsp; Maybe there&#039;s something in your API that I missed.<br />Changing the zoom level and therefore limit the number of buildings as a whole is not an option for several reasons. </p><p>Thanks in advance.</p>]]></content>
			<author>
				<name><![CDATA[vandem]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=60</uri>
			</author>
			<updated>2015-12-03T00:28:24Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=237#p237</id>
		</entry>
</feed>
