Esempio n. 1
0
    private void updateDebugInfoPanelScreenPosition(int id, GameObject panel)
    {
        ARLocationProvider locationProvider = ARLocationProvider.Instance;

        var entry    = manager.GetEntry(id);
        var instance = entry.instance;
        var location = entry.location;

        var text =
            // instance.name + "\n"
            //+ "LAT: " + location.latitude + "\n"
            //+ "LNG: " + location.longitude + "\n"
            //+ "ALT: " + location.altitude + "\n"
            //+ "POS: " + instance.transform.position
            location.label + "\n"
            + "╟е╦╝: " + Convert.ToInt16(Location.HorizontalDistance(locationProvider.currentLocation.ToLocation(), location)) + "╧лем";

        ARLocationDebugInfo.UpdateDebugInfoPanelScreenPositionAndText(instance, panel, text);
    }
Esempio n. 2
0
    private void Update()
    {
        if (!playing)
        {
            return;
        }

        // If there is no location provider, or spline, do nothing
        if (locationProvider == null || spline == null || !locationProvider.isEnabled)
        {
            return;
        }

        // Get spline point at current parameter
        var s = spline.Length * u;

        var data = spline.GetPointAndTangentAtArcLength(s);
        var tan  = data.tangent;

        // Move object to the point
        var smoothMove    = GetComponent <SmoothMove>();
        var useSmoothMove = !(smoothMove == null || locationProvider.provider.isRawTime());

        if (useSmoothMove)
        {
            smoothMove.Target = data.point - translation;
        }
        else
        {
            transform.localPosition = data.point - translation;
        }

        // Set orientation
        transform.localRotation = Quaternion.LookRotation(new Vector3(tan.x, tan.y, tan.z), up);

        // Check if we reached the end of the spline
        u = u + (speed * Time.deltaTime) / spline.Length;
        if (u >= 1 && !loop)
        {
            u       = 0;
            playing = false;
        }
        else
        {
            u = u % 1.0f;
        }

        // If there is a line renderer, render the path
        if (lineRenderer != null)
        {
            lineRenderer.useWorldSpace = true;
            var t = arLocationRoot.GetComponent <Transform>();
            spline.DrawCurveWithLineRenderer(lineRenderer, p => t.TransformVector(p - translation));
        }

        if (showDebugInfo)
        {
            var text = name + "\n"
                       + "POS: " + transform.position + "\n"
                       + "LPOS: " + transform.localPosition + "\n"
                       + "PathLength: " + s + "\n"
                       + "PathParam: " + u + "\n"
                       + "DST: " + Vector3.Distance(transform.position, Camera.main.transform.position);

            ARLocationDebugInfo.UpdateDebugInfoPanelScreenPositionAndText(gameObject, debugInfoPanel, text);
        }
    }