Topic: NGUI Rotate the camera on a compass

Hello

using UnityEngine;

namespace InfinityCode.OnlineMapsExamples
{
    [AddComponentMenu("Infinity Code/Online Maps/Examples (API Usage)/RoteteCameraByGPSExample")]
    public class RoteteCameraByGPSExample : MonoBehaviour
    {
        private void Start()
        {
            OnlineMapsLocationService.instance.OnCompassChanged += OnCompassChanged;
        }

        private void OnCompassChanged(float f)
        {
            OnlineMapsTileSetControl.instance.cameraRotation.y = f * 360;
        }
    }
}

NGUI Only Texture. The above source does not operate.

        private void OnCompassChanged(float f)
        {
            this.transform.rotation = Quaternion.Euler(0,0,angle); //(UITexture GameObject)
        }

The above source, rotate well. But there is a problem with touch and drag the marker.

Please NGUI Rotate the camera on a compass.

I'm sorry that I can not speak English.

Thank you.

Re: NGUI Rotate the camera on a compass

Hello.

This example is created for Tileset.
NGUI control does not support rotation of map.
If you want to rotate the camera / map, use Tileset control.

At the moment I have no idea how to convert the screen coordinate to relative point of rotated widget.
I'll try to ask NGUI creators. If they give me some advice, we will add this feature.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: NGUI Rotate the camera on a compass

That's funny.
I wrote previous post and immediately found a way how to do it.
Within 24 hours we will release update (through the built-in update system), which will support the rotation of NGUI map.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: NGUI Rotate the camera on a compass

Thank you. Answer.

I look forward to solutions.

Re: NGUI Rotate the camera on a compass

Hello.

Update is now available.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

6 (edited by mininox 2016-07-25 05:46:23)

Re: NGUI Rotate the camera on a compass

Answer Thank you

I was late for an answer.

How use?

my version v2.4.0.53.

I've written to the code above

private void OnCompassChanged(float f)
{
        this.transform.rotation = Quaternion.Euler(0,0,angle); //(UITexture GameObject)
}

There are still problems (Marker Position problems) when Drag.

Re: NGUI Rotate the camera on a compass

Hello.

What is «angle» in your script?
The parameter is called «f».

The code that I tested, and that works for NGUI:

using UnityEngine;

public class RotateNGUITextureByCompass : MonoBehaviour
{
    private void Start()
    {
        OnlineMapsLocationService.instance.OnCompassChanged += OnCompassChanged;
    }

    private void OnCompassChanged(float f)
    {
        transform.rotation = Quaternion.Euler(0, 0, f * 360);
    }
}
Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

8 (edited by mininox 2016-07-25 09:18:54)

Re: NGUI Rotate the camera on a compass

Hello.

private void OnCompassChanged(float compass)
    {
        Debug.Log("compass : " + compass);
        int angle = (int)(compass * 360);
        this.MainUI.t_Compass.text = angle.ToString();
        this.Map.transform.rotation = Quaternion.Euler(0, 0, angle);
    }

The map will rotate well.

but When dragging a rotated map, marker is problem.

link : https://dl.dropboxusercontent.com/u/164 … G_0581.m4v

Re: NGUI Rotate the camera on a compass

Hello.

I can see on the video that you have problems with custom marker system for NGUI, right?
We fixed it. Now it will work correctly.
Please update Online Maps.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: NGUI Rotate the camera on a compass

Thank you for quick response.

It works fine.