<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — How to rotate the map with one finger?]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=712&amp;type=atom" />
	<updated>2017-11-28T14:10:46Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=712</id>
		<entry>
			<title type="html"><![CDATA[Re: How to rotate the map with one finger?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3084#p3084" />
			<content type="html"><![CDATA[<p>Thank you, Alex! I&#039;ll try your solution <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[YanaAzur]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=597</uri>
			</author>
			<updated>2017-11-28T14:10:46Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3084#p3084</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How to rotate the map with one finger?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3083#p3083" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Yes, you have two ways:<br />1. Disable Allow Camera Control, and implement your own camera rotation around the map.</p><p>2. Something like this:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class RotateCameraUsingOneFinger:MonoBehaviour
{
    public Vector2 cameraSpeed = Vector2.one;

    private OnlineMapsTileSetControl control;
    private Vector2 lastGestureCenter;
    private bool hasRotation = false;

    private void Start()
    {
        control = OnlineMapsTileSetControl.instance;
        control.allowUserControl = false;
        control.cameraSpeed = Vector2.zero;
    }

    private void Update()
    {
        if (control.GetTouchCount() != 1)
        {
            if (hasRotation)
            {
                hasRotation = false;
                lastGestureCenter = Vector2.zero;
            }
            return;
        }

        hasRotation = true;
        Vector2 center = control.GetInputPosition();
        if (lastGestureCenter == Vector2.zero) lastGestureCenter = center;
        else if (lastGestureCenter != center)
        {
            Vector2 offset = lastGestureCenter - center;
            control.cameraRotation.x -= offset.y / 10f * cameraSpeed.x;
            control.cameraRotation.y -= offset.x / 10f * cameraSpeed.y;
            lastGestureCenter = center;
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-11-28T14:05:59Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3083#p3083</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How to rotate the map with one finger?]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3081#p3081" />
			<content type="html"><![CDATA[<p>By default user can pan the map with one finger, and zoom/rotate map with two-finger gesture. I have unchecked &quot;Allow User Control&quot; and &quot;Allow Zoom&quot; options on &quot;Online Maps Tile Set Control&quot; component. Now all user can do is to rotate the map with 2 fingers around current GPS location. Is it possible to change this allowing user rotate the map with single finger?</p>]]></content>
			<author>
				<name><![CDATA[YanaAzur]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=597</uri>
			</author>
			<updated>2017-11-28T13:09:18Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3081#p3081</id>
		</entry>
</feed>
