<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Rotate Map with gyroscope]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=768&amp;type=atom" />
	<updated>2018-02-11T11:17:47Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=768</id>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3370#p3370" />
			<content type="html"><![CDATA[<p>If you use Allow Camera Control, example:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/RotateCameraByCompassExample.html">http://infinity-code.com/atlas/online-m … ample.html</a></p><p>Otherwise just set<br /></p><div class="codebox"><pre><code>containerTransform.rotation = Quaternion.Euler (0, f, 0);</code></pre></div><p>where f is the value from the example above.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-11T11:17:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3370#p3370</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3367#p3367" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>To do this, rotate the map only using the y-axis.</p><p>Actually you can do it using Allow Camera Control too.<br />Just set Camera Rotation Speed X - 0.</p></blockquote></div><br /><p>Thanks, that worked without using the gyroscope or the compass.</p><p>But I wanted to use maybe the compass to rotate. How can I do it with the compass then?</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-10T19:50:18Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3367#p3367</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3357#p3357" />
			<content type="html"><![CDATA[<p>To do this, rotate the map only using the y-axis.</p><p>Actually you can do it using Allow Camera Control too.<br />Just set Camera Rotation Speed X - 0.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-09T17:48:15Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3357#p3357</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3355#p3355" />
			<content type="html"><![CDATA[<p>Thanks, but the thing is i have a kind of a 3D showing map. I rotate the camera to fit a 3D perspective like shown in the image attached.</p><p>I can i use the gyro or the compass to rotate the camera and still maintain the 3D perspective?</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-09T16:31:32Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3355#p3355</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3347#p3347" />
			<content type="html"><![CDATA[<p>Something like that (in the general case):<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class RotateMapUsingGyro:MonoBehaviour
{
    private OnlineMaps map;
    private Transform containerTransform;

    private void Start()
    {
        Input.gyro.enabled = true;
        map = OnlineMaps.instance;

        // Wrap the map in a new GameObject to rotate around the center.
        GameObject container = new GameObject(&quot;Map Container&quot;);
        containerTransform = container.transform;
        containerTransform.position = map.transform.position + new Vector3(map.tilesetSize.x / -2, 0, map.tilesetSize.y / 2);
        map.transform.parent = containerTransform;
    }

    private void Update()
    {
        Vector3 rate = Input.gyro.rotationRate;
        containerTransform.Rotate(rate);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-09T11:37:45Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3347#p3347</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3343#p3343" />
			<content type="html"><![CDATA[<p>Hi again</p><p>I&#039;ve tried to follow your instructions, but im not able to make it... i think i&#039;m confusing all.</p><p>Please can you make an example how to rotate map via gyro without user control? whith the camera fixed...</p><p>Thanks you</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-08T23:30:04Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3343#p3343</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3328#p3328" />
			<content type="html"><![CDATA[<p>How to use a gyroscope:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/ChangePositionUsingGyro.html">http://infinity-code.com/atlas/online-m … gGyro.html</a><br /><a href="https://docs.unity3d.com/ScriptReference/Gyroscope.html">https://docs.unity3d.com/ScriptReference/Gyroscope.html</a></p><p>How to rotate the point (camera) around a point (center):<br /><a href="https://stackoverflow.com/a/13695630">https://stackoverflow.com/a/13695630</a></p><p>The current rotation implementation can be found in OnlineMapsControlBase3D.UpdateCameraPosition.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-05T11:19:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3328#p3328</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3325#p3325" />
			<content type="html"><![CDATA[<p>Can you make a example how to do it with the device gyroscope?</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-04T19:34:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3325#p3325</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3324#p3324" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Yes, of course it&#039;s possible.<br />If you are using Camera Control - OFF, you can control the camera as you want.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-04T14:00:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3324#p3324</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Rotate Map with gyroscope]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3322#p3322" />
			<content type="html"><![CDATA[<p>Hi </p><p>I&#039;m trying to rotate the map with compass, without user control ON (Camera control), and rotate it around the user GPS location.</p><p>The examples only work with Camera control ON...</p><p>Is it possible?</p><p>Best regards</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-04T12:07:37Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3322#p3322</id>
		</entry>
</feed>
