Пример #1
0
    public static bool MakeLocal(VtsMap umap, double[] navPt)
    {
        Util.CheckArray(navPt, 3);
        Map map = umap.GetVtsMap();

        if (!map.GetMapconfigAvailable())
        {
            return(false);
        }
        double[] p = map.Convert(navPt, Srs.Navigation, Srs.Physical);
        { // swap YZ
            double tmp = p[1];
            p[1] = p[2];
            p[2] = tmp;
        }
        Vector3 v = Vector3.Scale(VtsUtil.V2U3(p), umap.transform.localScale);

        if (map.GetProjected())
        {
            umap.transform.position = -v;
        }
        else
        {
            float m = v.magnitude;
            umap.transform.position = new Vector3(0, -m, 0);              // altitude
            umap.transform.rotation =
                Quaternion.Euler(0, (float)navPt[0] + 90.0f, 0)           // align to north
                * Quaternion.FromToRotation(-v, umap.transform.position); // latlon
        }
        return(true);
    }
Пример #2
0
 void Update()
 {
     coordsUnity.text = "";
     coordsVts.text   = "";
     if (!map.GetVtsMap().GetMapconfigAvailable())
     {
         return;
     }
     double[] p = VtsUtil.U2V3(transform.position);
     p = map.UnityToVtsNavigation(p);
     coordsUnity.text = "Unity World: " + transform.position.ToString("F5");
     coordsVts.text   = "Vts Navigation: " + VtsUtil.V2U3(p).ToString("F5");
 }
Пример #3
0
    void Update()
    {
        coordsUnity.text = "";
        coordsVts.text   = "";
        if (!map.GetVtsMap().GetMapconfigAvailable())
        {
            return;
        }
        Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (!Physics.Raycast(ray, out hit))
        {
            return;
        }
        double[] p = VtsUtil.U2V3(hit.point);
        p = map.UnityToVtsNavigation(p);
        coordsUnity.text = "Unity World: " + hit.point.ToString("F5");
        coordsVts.text   = "Vts Navigation: " + VtsUtil.V2U3(p).ToString("F5");
    }
Пример #4
0
 private void Start()
 {
     umap = GetComponent <VtsMap>();
     vmap = umap.GetVtsMap();
 }