<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — zoom and CameraUpdate]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=899&amp;type=atom" />
	<updated>2018-09-29T19:19:50Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=899</id>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3983#p3983" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>I&#039;m sorry, I did not want to confuse you.<br />Vanga - is a Bulgarian prophetess.<br /><a href="https://en.wikipedia.org/wiki/Baba_Vanga">https://en.wikipedia.org/wiki/Baba_Vanga</a></p><p>&quot;Vanga mode - ON&quot; means &quot;My prediction&quot;.</p></blockquote></div><p>I know what that means.) Just apologized for the translation, Google translates poorly. He&#039;s kind of a rude translator, and often wrong.</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-29T19:19:50Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3983#p3983</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3981#p3981" />
			<content type="html"><![CDATA[<p>I&#039;m sorry, I did not want to confuse you.<br />Vanga - is a Bulgarian prophetess.<br /><a href="https://en.wikipedia.org/wiki/Baba_Vanga">https://en.wikipedia.org/wiki/Baba_Vanga</a></p><p>&quot;Vanga mode - ON&quot; means &quot;My prediction&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-09-28T20:28:10Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3981#p3981</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3978#p3978" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>Vanga mode - ON:</p></blockquote></div><p>Sorry. It&#039;s not my English so rude, the translator Google is so stupid (</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-28T13:50:44Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3978#p3978</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3975#p3975" />
			<content type="html"><![CDATA[<p>Vanga mode - ON:<br />you have disabled not all the parts of the code.</p><p>Look in OnlineMapsControlBase3D.AfterUpdate and OnlineMapsControlBase3D.OnGestureZoom.</p><p>But the easiest way to turn off rotation is to set cameraSpeed = new Vector2 (1, 0).</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-09-28T01:44:54Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3975#p3975</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3974#p3974" />
			<content type="html"><![CDATA[<p>You see. I have disabled all parts of the code where the value cameraRotation.y is assigned. But the camera still rotates. Checked on the Nox emulator. I can not yet from the phone, but it&#039;s strange if the phone is different</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-28T01:12:50Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3974#p3974</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3973#p3973" />
			<content type="html"><![CDATA[<p>Did I miss something?</p><p>The first two lines, this is the answer to the post 3.<br />The second two lines, this is the answer to the post 4.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-09-28T01:09:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3973#p3973</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3972#p3972" />
			<content type="html"><![CDATA[<p>Thank you!<br />Please answer, please, not the previous question about the turn.</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-27T13:52:27Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3972#p3972</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3971#p3971" />
			<content type="html"><![CDATA[<p>Use the compilation directives to enable or disable part of the code for a specific platform.<br /><a href="https://docs.unity3d.com/Manual/PlatformDependentCompilation.html">https://docs.unity3d.com/Manual/Platfor … ation.html</a></p><p>In OnlineMapsTileSetControl.OnSmoothZoomBegin, save the coordinates of the map.<br />In OnlineMapsTileSetControl.OnSmoothZoomProcess, restore the coordinates of the map.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-09-27T13:46:21Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3971#p3971</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3969#p3969" />
			<content type="html"><![CDATA[<p>And another question.<br />How can I disable moving the map with two fingers during a smooth zoom on my phone?</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-27T12:59:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3969#p3969</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3968#p3968" />
			<content type="html"><![CDATA[<p>Thanks for the help)</p><p>Tell me how to turn off the rotation of the map with two fingers for the phone. I have covered all the code and have not found this place. That&#039;s how I made a rotation around the center for the editor. And for the phone, you need to turn off the rotation with your finger to rotate only from the compass.</p><div class="codebox"><pre><code>protected void UpdateCameraPosition()
    {
        if (cameraRotation.x &gt; maxCameraRotationX) cameraRotation.x = maxCameraRotationX;
        else if (cameraRotation.x &lt; 0) cameraRotation.x = 0;

        cameraRotation.x = MyCode.MapController.instance.cameraRotationX;
#if UNITY_EDITOR
        if (Input.GetMouseButtonDown(1)) {
            this.isBeginRotateCamera = true;
        }
        if (Input.GetMouseButton(1)) {
            cameraRotation.y = GetAngleCameraFromCenterScreenByMousePosition();
        }
#endif

        float rx = 90 - cameraRotation.x;
        if (rx &gt; 89.9) rx = 89.9f;

        double px = Math.Cos(rx * Mathf.Deg2Rad) * cameraDistance;
        double py = Math.Sin(rx * Mathf.Deg2Rad) * cameraDistance;
        double pz = Math.Cos(cameraRotation.y * Mathf.Deg2Rad) * px;
        px = Math.Sin(cameraRotation.y * Mathf.Deg2Rad) * px;

        Vector3 targetPosition = transform.position;
        if (this is OnlineMapsTileSetControl)
        {
            Vector3 offset = new Vector3(map.tilesetSize.x / -2, 0, map.tilesetSize.y / 2);
            OnlineMapsTileSetControl control = OnlineMapsTileSetControl.instance;

            if (control.smoothZoom &amp;&amp; control.smoothZoomStarted) targetPosition = originalPosition;
            
            if (control.useElevation &amp;&amp; control.elevationZoomRange.InRange(map.zoom))
            {
                double tlx, tly, brx, bry;
                map.GetCorners(out tlx, out tly, out brx, out bry);
                float yScale = control.GetBestElevationYScale(tlx, tly, brx, bry);
                if (cameraAdjustTo == OnlineMapsCameraAdjust.maxElevationInArea) offset.y = control.GetMaxElevationValue(yScale);
                else offset.y = control.GetElevationValue(targetPosition.x, targetPosition.z, yScale, tlx, tly, brx, bry);
            }
            
            offset.Scale(control.smoothZoomStarted? control.originalScale: transform.lossyScale);
            targetPosition += transform.rotation * offset;
        }

        Vector3 oldPosition = activeCamera.transform.position;
        Vector3 newPosition = transform.rotation * new Vector3((float)px, (float)py, (float)pz) + targetPosition;

        activeCamera.transform.position = newPosition;
        activeCamera.transform.LookAt(targetPosition);

        if (oldPosition != newPosition &amp;&amp; OnCameraControl != null) OnCameraControl();
    }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-27T12:33:53Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3968#p3968</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3965#p3965" />
			<content type="html"><![CDATA[<p>Hello.</p><div class="quotebox"><blockquote><p>The problem is that I don&#039;t understand how to limit the smooth scaling to not &lt; 12.</p></blockquote></div><p>Use this example, and add an additional check before line 51:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/UpdateZoomOnSmoothZoomProcessExample.html">http://infinity-code.com/atlas/online-m … ample.html</a><br /></p><div class="codebox"><pre><code>else if (OnlineMaps.instance.zoom &lt;= 12 &amp;&amp; t.localScale.x &lt; 1)
{
  OnlineMaps.instance.zoom = 12;
  t.localScale = Vector3.one;
}</code></pre></div><div class="quotebox"><blockquote><p>Also, you cannot force the map to set its position during scaling.</p></blockquote></div><p>Why not?</p><p>Perhaps you mean that smooth zoom can happen not at the center point. But in this case you can use Zoom Mode - Center.</p><p>In general, it is better to use Online Maps v3 beta for smooth zoom.<br />It has a built-in float zoom, and perhaps (most likely) is much better suited for your purposes.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-09-25T18:53:49Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3965#p3965</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[zoom and CameraUpdate]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3964#p3964" />
			<content type="html"><![CDATA[<p>Good evening.<br />I need to limit the radius of the map. I inserted my code into your scripts. Now I fix bugs, but it&#039;s too difficult, I kind of did everything you need, but it does not work.</p><br /><p>It is necessary that the phone has a smooth zoom between 12-19 zoom to the limit of 12 did not go this smooth zoom. Really?</p><p>If the scale is &lt; 15, you must set the center of the map to the center of the user around which the radius is. You can only move around the map when you zoom in &gt; 15 and only to the radius boundaries.</p><p>The problem is that I don&#039;t understand how to limit the smooth scaling to not &lt; 12.<br />Also, you cannot force the map to set its position during scaling. When I do the fingers the zoom is less than 15, the map should be centered in the user, but this is not happening and position of the card outside of the radius, probably because the method is &quot;UpdateGestureZoom&quot; and &quot;CameraUpdatePosition&quot; do not work at the same time, called &quot;CameraUpdatePosition&quot; in &quot;UpdateGestureZoom&quot; did not give an adequate result.</p><p>Please tell me how you can correctly enter it into your plugin?</p><div class="codebox"><pre><code>    public bool SetPositionCameraByCircleBorder(double px, double py) {
        Vector2 p1 = this.GetPositionPlayerInMeters();
        Vector2 p2 = this.GetPositionMapInMeters((float)px, (float)py);
        float angle = OnlineMapsUtils.Angle2D(p1, p2);
        angle += 90;
        float distance = OnlineMapsUtils.DistanceBetweenPointsF(
            new Vector2(this.posUser.x, this.posUser.y),
            new Vector2((float)px, (float)py)
        );


        float radius = MyCode.JourneyObject.instance.drawRadiusMapForFog.radiusInKM;
        if (radius &lt; distance) {
            OnlineMapsUtils.GetCoordinateInDistance(
                this.posUser.x, this.posUser.y,
                radius,
                angle,
                out double nlon, out double nlat
            );
            map.SetPosition(nlon, nlat);
            return true;
        }
        return false;
    }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-09-25T14:21:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3964#p3964</id>
		</entry>
</feed>
