<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Orbit rotation camera.]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2045&amp;type=atom" />
	<updated>2022-10-07T22:16:22Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=2045</id>
		<entry>
			<title type="html"><![CDATA[Re: Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8646#p8646" />
			<content type="html"><![CDATA[<p>Exactly ! Perfect ! Thanks Alex! Thank you</p>]]></content>
			<author>
				<name><![CDATA[LazzLab]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=669</uri>
			</author>
			<updated>2022-10-07T22:16:22Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8646#p8646</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8645#p8645" />
			<content type="html"><![CDATA[<p>Ahhh, I get it.<br />In this case, everything is much easier:<br /></p><div class="codebox"><pre><code>using UnityEngine;

namespace InfinityCode.OnlineMapsSupport
{
    public class RotateMap : MonoBehaviour
    {
        public OnlineMapsCameraOrbit cameraOrbit;
        public float duration = 3;
        private int direction;

        private void OnGUI()
        {
            if (GUILayout.Button(&quot;Left&quot;)) direction = 1;
            if (GUILayout.Button(&quot;Right&quot;)) direction = -1;
            if (GUILayout.Button(&quot;Stop&quot;)) direction = 0;
        }

        private void Update()
        {
            if (direction == 0) return;

            cameraOrbit.rotation.y += 360 * Time.deltaTime / duration * direction;
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-07T21:44:20Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8645#p8645</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8644#p8644" />
			<content type="html"><![CDATA[<p>With LearpAngle the camera will always stop at zero (North). It has to keep turning and always in a direction that I choose. As you suggest, if I start from the west it goes north clockwise and stops. If I start from the east it goes north counterclockwise and stops. I want to choose which direction to turn and stop it when I want. The &quot;narrator&quot; will read a text (story = time) while the camera orbits around a marker and at the end of the (story = time) the animation of the orbiting camera stops.</p>]]></content>
			<author>
				<name><![CDATA[LazzLab]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=669</uri>
			</author>
			<updated>2022-10-07T19:10:06Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8644#p8644</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8643#p8643" />
			<content type="html"><![CDATA[<p>You wrote this code based on ResetCameraRotationExample, right?!<br />Try replacing:<br /></p><div class="codebox"><pre><code>cameraOrbit.rotation.y = Mathf.Lerp(camY, -360 * 2, f);     </code></pre></div><p>to<br /></p><div class="codebox"><pre><code>cameraOrbit.rotation.y = Mathf.LerpAngle(camY, 0, f);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-07T13:57:57Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8643#p8643</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8642#p8642" />
			<content type="html"><![CDATA[<p>I am working on this:</p><p>public float animationTime = 3;&nbsp; &nbsp; <br />&nbsp; &nbsp; public AnimationCurve animationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1);<br />&nbsp; &nbsp; private float time;<br />&nbsp; &nbsp; private bool isReset;&nbsp; &nbsp; <br />&nbsp; &nbsp; private float camY;<br />&nbsp; &nbsp; private OnlineMapsCameraOrbit cameraOrbit;</p><p>&nbsp; &nbsp; public void ButtonInteract()<br />&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; camY = cameraOrbit.rotation.y;<br />&nbsp; &nbsp; &nbsp; &nbsp; isReset = true;&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; private void Start()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; cameraOrbit = OnlineMapsCameraOrbit.instance;<br />&nbsp; &nbsp; }</p><p>&nbsp; &nbsp; private void Update()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; if (!isReset) return;&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; time += Time.deltaTime;<br />&nbsp; &nbsp; &nbsp; &nbsp; float t = time / animationTime;&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; if (t &gt;= 1)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset values<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time = 0;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; isReset = false;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t = 1;<br />&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; float f = animationCurve.Evaluate(t);&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; cameraOrbit.rotation.y = Mathf.Lerp(camY, -360 * 2, f);&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; }</p><p>The problem is that in this way I can only do 2 laps and I don&#039;t understand the behavior. I would like to spin the Chamber around its map center.</p>]]></content>
			<author>
				<name><![CDATA[LazzLab]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=669</uri>
			</author>
			<updated>2022-10-07T10:46:19Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8642#p8642</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8641#p8641" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Unfortunately, I didn&#039;t understand your question.<br />Please rephrase it.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-10-07T10:22:43Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8641#p8641</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Orbit rotation camera.]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8640#p8640" />
			<content type="html"><![CDATA[<p>Hi Alex. <br />An orbital rotation of the chamber is possible with speed and direction to infinity?<br />I tried with OnlineMapsCameraOrbit.instance cameraOrbit.rotation.y = float * Time.deltaTime but it doesn&#039;t work.<br />Any suggestions? Cheers</p>]]></content>
			<author>
				<name><![CDATA[LazzLab]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=669</uri>
			</author>
			<updated>2022-10-07T09:54:51Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8640#p8640</id>
		</entry>
</feed>
