Topic: Rotation Hiccups on iOS

Hi Alex,
yesterday, I upgraded from 2.5.16.1 version to the last one (2.5.37.1). And now, I receive camera HICCUPS in every map rotation that I do (in 3D view). This issue didn't happen before on my iPhone 6s

What can be caused this?

Thanks in advance!

Re: Rotation Hiccups on iOS

Hello.

I've never seen such a problem.
In addition, I checked the change log and nothing of the changes should affect it.
Please send a video of the bug so I know exactly what to find.

Kind Regards,
Infinity Code Team

Re: Rotation Hiccups on iOS

Hi,
I found only one difference in the plugin settings (see the attached image) but even increasing these values the hiccups continues.
What are the recommended values??

thanks.

Post's attachments

Attachment icon capt.png 35.59 kb, 15 downloads since 2018-07-25 

Re: Rotation Hiccups on iOS

The cache is not related to this problem.

I think I was able to reproduce the problem.
This happens with "Allow Camera Control - On" + "Smooth Zoom - ON", right?
The problem occurs because mathematically every touch interaction is a little bit of rotation and a little bit of scaling at the same time.
Unfortunately, I right now do not have any ideas how to fix this.
I tried to work around this in several ways, but this makes the problem even worse.
It takes some time for experiments. Unfortunately, it is impossible to say exactly how much.

What can I suggest right now:
Handle gestures with some gesture framework (for example, TouchScript or EasyTouch).
I think this should help.
If such a way is suitable for your project, I can make such a script for you.

Kind Regards,
Infinity Code Team

Re: Rotation Hiccups on iOS

Ok, but with version 2.5.16 and "Allow Camera Control - ON" + "Smooth Zoom - ON" these hiccups did not happen, then, some change in the new scripts produced the issue.
Even, in the 2.5.37 version it is not solved by switching "Smooth Zoom" to OFF

Thanks!!

Re: Rotation Hiccups on iOS

I visually compared the rotation on the device in v2.5.16 and v2.5.37.
At least for me, they work exactly the same way.

Please send a video that demonstrates the problem, and a full screenshot of your settings.
Right now I'm looking for a problem with my eyes closed trying to guess what you meant in the first post.
Maybe I'm just looking in the wrong direction.

Kind Regards,
Infinity Code Team

7 (edited by maurogarcia 2018-07-30 18:48:08)

Re: Rotation Hiccups on iOS

Hi,
I'm rotating the camera according de iPhone compass, using the "OnCompassChanged" action of OnlineMapsLocationServiceBase.cs, maybe something change with the new version, for example, how do you take the values of the compass? or the capture frequency?

thanks!

Re: Rotation Hiccups on iOS

You did not mention the compass before.
Yes, with 2.5.16 there were changes in Online Maps Location Service, but this affects to rotation of the marker.

Try this way:

using UnityEngine;

public class RotateCameraByCompassExample2 : MonoBehaviour
{
    public float rotationSpeed = 1f;

    private float rotation;
    private bool isFirstValue = true;
    private OnlineMapsTileSetControl control;

    private void Start()
    {
        control = OnlineMapsTileSetControl.instance;
        OnlineMapsLocationService.instance.OnCompassChanged += OnCompassChanged;
        OnlineMapsLocationService.instance.compassThreshold = 0;
    }

    private void OnCompassChanged(float f)
    {
        rotation = f * 360;
        if (isFirstValue)
        {
            control.cameraRotation.y = rotation;
            isFirstValue = false;
        }
    }

    private void Update()
    {
        float newRotation = Mathf.LerpAngle(control.cameraRotation.y, rotation, rotationSpeed * Time.deltaTime);
        control.cameraRotation.y = newRotation;
    }
}
Kind Regards,
Infinity Code Team

Re: Rotation Hiccups on iOS

Hi Alex, sorry to jump on a thread, but i may have a similar issue. I am on a slightly older version of online maps, and have noticed that the compass values are very inconsistent. I am using compass rotation with the default position marker. Sometimes it reads heading correctly, sometimes it is way off, almost as if it only rotates the marker 90 degrees max. I am not manipulating the values in any way, and have not been able to duplicate the problem consistently.
Is this something that may have been fixed in a recent update?

Re: Rotation Hiccups on iOS

Hello.

Yes, in Online Maps v2.5.25 added built-in ability Lerp the rotation of Location Service marker.
But if you are using an older version, you can do it manually as in the example above.

Kind Regards,
Infinity Code Team

Re: Rotation Hiccups on iOS

Thanks for your reply Alex,
Let me clarify a few things:
I have now updated online maps to the latest stable version via the update tool in the editor.
I am using your script above to rotate the map with the compass values, and it works great, much better then the older example.

The problem I am having is with android, sometimes when the map loads, the compass reads correctly, north on the map is north in real life, etc.
However sometimes it seems like the compass initializes wrong. north on the map does not even come close to real north. I am also monitoring the compass values on screen. when the compass does not initialize correctly, the compass values wrap between 280-360 degrees, thats it. this happens with gps emulation on or off, and seems to happen right when the scene is loaded with the map.
I am not modifying the compass values in any way, simply using your script above and subscribing to the compass events on start to get the compass values on screen. this problem was occurring randomly before i started monitoring the values on screen, and was happening in the older version as well.

Re: Rotation Hiccups on iOS

Online Maps Location Service is just a wrapper for Unity Location Service and Unity Compass classes.
Try to take the compass value from Compass.trueHeading directly.
https://docs.unity3d.com/ScriptReferenc … ading.html

Kind Regards,
Infinity Code Team

Re: Rotation Hiccups on iOS

I did what you suggested, and got the same values using unity location service. I found out that you can calibrate android compass, go to the phone dialer, type *#0*# and you will get a testing screen. click the sensor button, scroll down to the compass. if you rotate the phone on all 3 axis 3 times each, it will calibrate the compass. this seems to have fixed my issue. just seems strange that sometimes it was accurate, and other times not so much.