<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — 2D marker rotation]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1988&amp;type=atom" />
	<updated>2022-06-22T09:49:33Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1988</id>
		<entry>
			<title type="html"><![CDATA[Re: 2D marker rotation]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8406#p8406" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[digitalmkt]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=313</uri>
			</author>
			<updated>2022-06-22T09:49:33Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8406#p8406</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: 2D marker rotation]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8405#p8405" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-06-22T08:46:32Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8405#p8405</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: 2D marker rotation]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8404#p8404" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[digitalmkt]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=313</uri>
			</author>
			<updated>2022-06-22T06:28:27Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8404#p8404</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: 2D marker rotation]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8403#p8403" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2022-06-21T14:30:18Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8403#p8403</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[2D marker rotation]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=8402#p8402" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[digitalmkt]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=313</uri>
			</author>
			<updated>2022-06-21T11:18:26Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=8402#p8402</id>
		</entry>
</feed>
