<?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 — 2D marker rotation]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=1988</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1988&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in 2D marker rotation.]]></description>
		<lastBuildDate>Wed, 22 Jun 2022 09:49:33 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: 2D marker rotation]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=8406#p8406</link>
			<description><![CDATA[<p>Perfect!! it´s running like a charm now! The 2Dmarkers are keeping the orientation while moving the device. Thanks for the help.</p>]]></description>
			<author><![CDATA[null@example.com (digitalmkt)]]></author>
			<pubDate>Wed, 22 Jun 2022 09:49:33 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=8406#p8406</guid>
		</item>
		<item>
			<title><![CDATA[Re: 2D marker rotation]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=8405#p8405</link>
			<description><![CDATA[<p>Oops... I forgot that marker.rotation takes values from 0 to 1 and cameraOrbit.rotation.y gives values 0-360.<br />Updated the script in post 2.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 22 Jun 2022 08:46:32 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=8405#p8405</guid>
		</item>
		<item>
			<title><![CDATA[Re: 2D marker rotation]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=8404#p8404</link>
			<description><![CDATA[<p>Thank you very much. The code above works by rotating the 2Dmarks, but the markers also don´t stop spinning when I move the device around and deaccelerate to spinning up to the position, like a helicopter. I tried to change the code below to control the 2DMarker Lerp but when I drag the map only the 2Dmarkers (including the Player) move but the map is still frozen.</p><div class="codebox"><pre><code>public class RotateMarkersByCamera : MonoBehaviour
{
    private OnlineMapsCameraOrbit cameraOrbit;
    private OnlineMapsMarkerManager marker;

    private void Start()
    {
        cameraOrbit = OnlineMapsCameraOrbit.instance;
        marker = OnlineMapsMarkerManager.instance;
        cameraOrbit.OnCameraControl += OnCameraControl;
    }

    private void OnCameraControl()
    {
        foreach (OnlineMapsMarker m in OnlineMapsMarkerManager.instance)
        {
            float markerRotation = m.rotation.y;
            var markerRotationY = Mathf.Lerp(markerRotation, cameraOrbit.rotation.y, cameraOrbit.speed.y);
            m.rotation = markerRotationY;
        }
        OnlineMaps.instance.Redraw();
    }</code></pre></div><br /><p>Attached is a video of the spinning markers before my changes.</p><p>Thanks again.</p>]]></description>
			<author><![CDATA[null@example.com (digitalmkt)]]></author>
			<pubDate>Wed, 22 Jun 2022 06:28:27 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=8404#p8404</guid>
		</item>
		<item>
			<title><![CDATA[Re: 2D marker rotation]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=8403#p8403</link>
			<description><![CDATA[<p>Hello.</p><p>Example:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class RotateMarkersByCamera : MonoBehaviour
{
    private OnlineMapsCameraOrbit cameraOrbit;

    private void Start()
    {
        cameraOrbit = OnlineMapsCameraOrbit.instance;
        cameraOrbit.OnCameraControl += OnCameraControl;
    }

    private void OnCameraControl()
    {
        foreach (OnlineMapsMarker m in OnlineMapsMarkerManager.instance)
        {
            m.rotation = cameraOrbit.rotation.y / 360;
        }
        OnlineMaps.instance.Redraw();
    }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 21 Jun 2022 14:30:18 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=8403#p8403</guid>
		</item>
		<item>
			<title><![CDATA[2D marker rotation]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=8402#p8402</link>
			<description><![CDATA[<p>Hi Alex, I´m trying to use CameraOrbit with 2D markers but when I turn 180 degrees the markers keep upsidedown. Any way to make the 2D markers rotate the opposite way like User Locations does?</p><p>Thank you very much!</p>]]></description>
			<author><![CDATA[null@example.com (digitalmkt)]]></author>
			<pubDate>Tue, 21 Jun 2022 11:18:26 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=8402#p8402</guid>
		</item>
	</channel>
</rss>
