<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Move 3dMarker depending on camera look]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=415</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=415&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Move 3dMarker depending on camera look.]]></description>
		<lastBuildDate>Mon, 13 Feb 2017 12:42:27 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Move 3dMarker depending on camera look]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1813#p1813</link>
			<description><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Hello.</p><p>The modified script is attached.</p><p>1. Move «ThirdPersonUserControl» script outside of «Standard Assets» or move «Online Maps» folder into «Standard Assets».<br />2. Wrap «ThirdPersonController» in a new empty GameObject, and create a prefab from the outer GameObject.<br />3. Use the new prefab for 3D marker.</p></blockquote></div><p>Thanks, Alex! Works perfectly<br /></p><div class="codebox"><pre><code>...
  api.GetTilePosition(out px, out py);
...

 var cameraLook = Vector3.Scale(m_Cam.forward, new Vector3(-1, 0, -1)).normalized;
                m_Move = h * cameraLook + v * m_Cam.right;
                px -= m_Move.x * moveScale;
                py += m_Move.z * moveScale;
                double lng, lat;
                api.projection.TileToCoordinates(px, py, api.zoom, out lng, out lat);
                api.SetPosition(lng, lat);</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DolceVita)]]></author>
			<pubDate>Mon, 13 Feb 2017 12:42:27 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1813#p1813</guid>
		</item>
		<item>
			<title><![CDATA[Re: Move 3dMarker depending on camera look]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1810#p1810</link>
			<description><![CDATA[<p>Hello.</p><p>The modified script is attached.</p><p>1. Move «ThirdPersonUserControl» script outside of «Standard Assets» or move «Online Maps» folder into «Standard Assets».<br />2. Wrap «ThirdPersonController» in a new empty GameObject, and create a prefab from the outer GameObject.<br />3. Use the new prefab for 3D marker.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 13 Feb 2017 01:37:45 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1810#p1810</guid>
		</item>
		<item>
			<title><![CDATA[Move 3dMarker depending on camera look]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=1806#p1806</link>
			<description><![CDATA[<p>Hi,</p><p>Frankly to say, I am new in Unity3d (hovewer skilled in C#).<br />I have a 3dmap with buildings etc. I placed a 3dmarker (which is basicly a default unity3d thirdPersonController).</p><p>I have the script to control my 3dMarker:<br /></p><div class="codebox"><pre><code>    private void FixedUpdate()
    {
        OnlineMaps api = OnlineMaps.instance;

        float h = CrossPlatformInputManager.GetAxis(&quot;Horizontal&quot;);
        float v = CrossPlatformInputManager.GetAxis(&quot;Vertical&quot;);

       
        m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized;
        var position = v * m_CamForward + h * m_Cam.right;
        if (position.magnitude &gt; 1f) position.Normalize();
        //probably I need to do something here to change h and v depending on the camera angle

        px += h / 100000;
        py += v / 100000;
        api.SetPosition(px, py);
}</code></pre></div><p>So right now my player move in 4 directions. However, if I try to change camera look (with mouse right click), I want my character&nbsp; move forward concidering new &quot;north&quot;.</p><p>Could you please give a clue how to do this? Thank you.</p>]]></description>
			<author><![CDATA[null@example.com (DolceVita)]]></author>
			<pubDate>Fri, 10 Feb 2017 18:26:20 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=1806#p1806</guid>
		</item>
	</channel>
</rss>
