<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Teleport and moving the map]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=386&amp;type=atom" />
	<updated>2017-02-09T14:43:00Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=386</id>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1795#p1795" />
			<content type="html"><![CDATA[<p>I just wanted to post and say thanks because this totally helped with an issue I was dealing with. Thank you!</p>]]></content>
			<author>
				<name><![CDATA[ShaneTheKing]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=329</uri>
			</author>
			<updated>2017-02-09T14:43:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1795#p1795</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1690#p1690" />
			<content type="html"><![CDATA[<p>It didn&#039;t work at first, but I changed the &#039;+&#039;s in &quot;(p.x + map.tilesetSize.x / -2, map.transform.position.y, p.z + map.tilesetSize.y / 2);&quot; to &#039;-&#039;s and now it works!!! Thank you sooo much!!</p>]]></content>
			<author>
				<name><![CDATA[alexandra]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=328</uri>
			</author>
			<updated>2017-01-17T14:23:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1690#p1690</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1689#p1689" />
			<content type="html"><![CDATA[<p>I made corrections in your code.<br />Of course, it is not tested, because I do not have VRTK.<br />But, theoretically, it should work.</p><div class="codebox"><pre><code>protected virtual void SetNewPosition(Vector3 position, Transform target)
{
    transform.position = CheckTerrainCollision(position, target);
    ///// Added code by Alexandra
    Vector3 p = transform.position;
    double lng, lat;
    OnlineMaps map = OnlineMaps.instance;
    OnlineMapsTileSetControl.instance.GetCoordsByWorldPosition(out lng, out lat, p);
    map.SetPosition(lng, lat);
    map.transform.position = new Vector3(p.x + map.tilesetSize.x / -2, map.transform.position.y, p.z + map.tilesetSize.y / 2);
    ///// End code added
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-17T13:55:28Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1689#p1689</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1688#p1688" />
			<content type="html"><![CDATA[<p>It seemed I had chosen a file, but not clicked &quot;Add file&quot; orz</p>]]></content>
			<author>
				<name><![CDATA[alexandra]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=328</uri>
			</author>
			<updated>2017-01-17T13:43:14Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1688#p1688</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1687#p1687" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Your post does not contain a script.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-17T12:38:22Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1687#p1687</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1685#p1685" />
			<content type="html"><![CDATA[<p>Hi! I&#039;ve tried doing what you said but I guess there&#039;s still something I&#039;m not quite getting as the player ends up outside of the map boundaries.<br />Attached is the VRTK library Teleport script. You can find the code I added by searching for &quot;Added code by Alexandra&quot;. Thank you so much again for your help <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[alexandra]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=328</uri>
			</author>
			<updated>2017-01-17T12:15:43Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1685#p1685</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1683#p1683" />
			<content type="html"><![CDATA[<p>Hello.</p><p>You need to change the location of map (map.SetPosition) instead of the position of the map GameObject.<br />Send me your teleport script. I will try to modify it for you.</p><p>Or you can do to map GameObject follow to player GameObject.<br />To do this:<br />1. Teleport.<br />2. Get the coordinates in the player position (OnlineMapsTileSetControl.GetCoordsByWorldPosition).<br />3. Set the new map coordinates (map.SetPosition).<br />4. Update map.transform.position, so center of map was under player position.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-16T23:38:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1683#p1683</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1681#p1681" />
			<content type="html"><![CDATA[<p>And the second image</p>]]></content>
			<author>
				<name><![CDATA[alexandra]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=328</uri>
			</author>
			<updated>2017-01-16T09:14:56Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1681#p1681</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Teleport and moving the map]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1680#p1680" />
			<content type="html"><![CDATA[<p>Hi!<br />We are using a basic teleport script to move across te map (specifically VRTK Basic Teleport), but the problem is that the player literally teleports to that position on the plane and the image on the plane itself does not move. This means that eventually the player ends up at the border of the plane.<br />Attached are two images to show what I mean.</p><p>Is there an easy way to compensate the map so that it takes the current player position and resets itself so that position is now the middle? Or should I try to modify the teleport script to do this instead?</p><p>I have already tried to do this instead of moving the player on teleport:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; double lng, lat;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OnlineMaps map = OnlineMaps.instance;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.projection.TileToCoordinates(target.position.x, target.position.z, map.zoom, out lng, out lat);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.SetPosition(lng, lat);</p><p>But this gives a strange result, the lng, lat is not as expected.</p>]]></content>
			<author>
				<name><![CDATA[alexandra]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=328</uri>
			</author>
			<updated>2017-01-16T09:13:32Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1680#p1680</id>
		</entry>
</feed>
