26 (edited by danielesuppo 2019-08-08 17:58:01)

Re: Some problem extending the horizon

Hello, I'm using your 1st tip (calculate the offset for the first point, and apply this offset for the remaining points) when the map is moved, but I have a problem: on top view it seem ok, but tilting the map it's evident that the elevation of the points is not correctly calculated.

This is a video to show you what I mean (from second 10)
https://vr.alicefit.com/ice_video_20190808-192152.webm

I've seen that also just panning the map I get "OnElevationUpdated" at the end of the movement (that's why when I release the mouse the track get correctly calculated).
So I have idea that this 1st tip cannot be used... I'm doing it wrong?

This is my code (p.s. I'm still using Vectrosity but this is not the issue, because if moving the map I call "UpdateLine", just like with "OnChangeZoom" and with "OnElevationUpdated", it work.

private void Start()
    {
        OnlineMaps.instance.OnChangeZoom += UpdateLine;
        OnlineMaps.instance.OnChangePosition += OnMapPan;
        OnlineMapsElevationManagerBase.instance.OnElevationUpdated += UpdateLine;
    }

....

void OnMapPan()
    {
            ///Get the distance difference only for the 1st point
            Vector3 oldPos = _convertedWordlPositionsToList[0];
            Vector2 firstCoord = _coords[0];
            Vector3 newPos = GetWorldPositionFromCoordinates(firstCoord);
            Vector3 difference = newPos - oldPos;

            ///Apply the difference to all points
            for (int ii = 0; ii < _convertedWordlPositionsToList.Count; ii++)
            {
                _convertedWordlPositionsToList[ii] += difference;
            }

            ///Update line
            myLine.points3 = _convertedWordlPositionsToList;
            myLine.Draw3D();
        }
    }


void UpdateLine()
    {
        _convertedWordlPositionsToList = GetWorldPositionsFromCoordinates(_coords);
        myLine.points3 = _convertedWordlPositionsToList;
        myLine.Draw3D();
    }

Re: Some problem extending the horizon

Interesting effect.

Unfortunately, it is very difficult to say what is wrong without debugging.
It looks like you are calculating the difference too early.
Try this way:

private bool waitUpdated = false;

OnlineMaps.instance.OnChangePosition += OnMapPan;

void OnMapPan()
{
    if (!waitUpdated) 
    {
        OnlineMaps.instance.OnMapUpdated += OnMapUpdated;
        waitUpdated = true;
    }
}

void OnMapUpdated()
{
    OnlineMaps.instance.OnMapUpdated -= OnMapUpdated;
    waitUpdated = false;

    // Prev OnMapPan content
}

If the problem persists, send me your project.
I will try to find the cause of the problem.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!