コード例 #1
0
    private void OnPositionerPositionUpdated()
    {
        var boxLocation = new LatLongAltitude();

        if (boxPositioner.TryGetLatLongAltitude(out boxLocation))
        {
            box.position = Api.Instance.SpacesApi.GeographicToWorldPoint(boxLocation);
        }
    }
コード例 #2
0
    private void OnPositionerTransformedPointChanged(Positioner positioner)
    {
        // A positioner has an updated resultant point, so update visual objects
        var sphere = m_positionerToSpheres[positioner];

        LatLongAltitude resultPointLLA;

        if (positioner.TryGetLatLongAltitude(out resultPointLLA))
        {
            sphere.transform.localPosition = Api.Instance.SpacesApi.GeographicToWorldPoint(resultPointLLA);
            sphere.SetActive(true);
        }
    }
コード例 #3
0
    private void UpdateVisualization()
    {
        if (
            m_positionerForQueryPoint == null ||
            m_positionerForResultPoint == null ||
            m_positionersForPathPoints == null ||
            m_pathPoints.Count != m_positionersForPathPoints.Count)
        {
            return;
        }


        var points = new List <Vector3>();

        foreach (var positioner in m_positionersForPathPoints)
        {
            LatLongAltitude pointLLA;
            if (!positioner.TryGetLatLongAltitude(out pointLLA))
            {
                continue;
            }

            var worldPoint = Api.Instance.SpacesApi.GeographicToWorldPoint(pointLLA);
            points.Add(worldPoint);
        }

#if UNITY_5_6_OR_NEWER
        m_pathLineRenderer.positionCount = points.Count;
#else
        m_pathLineRenderer.numPositions = points.Count;
#endif
        m_pathLineRenderer.SetPositions(points.ToArray());



        LatLongAltitude queryPointLLA;
        if (m_positionerForQueryPoint.TryGetLatLongAltitude(out queryPointLLA))
        {
            m_sphereInput.transform.localPosition = Api.Instance.SpacesApi.GeographicToWorldPoint(queryPointLLA);
            m_sphereInput.SetActive(true);
        }

        LatLongAltitude resultPointLLA;
        if (m_positionerForResultPoint.TryGetLatLongAltitude(out resultPointLLA))
        {
            m_sphereOutput.transform.localPosition = Api.Instance.SpacesApi.GeographicToWorldPoint(resultPointLLA);
            m_sphereOutput.SetActive(true);
        }
    }