Пример #1
0
    public void giveGPSData()
    {
        // Call Plugin for GPS Data
        double[] tmpDoubArr = gpsInstance.Call <double[]>("giveGPSData");
        updateGPStext.text = "GPS: Lat: " + tmpDoubArr[0] + ", Lon: " + tmpDoubArr[1];
        // Convert GPS Data into local coordinates
        double[] enu = coordUtil.geo_to_enu(tmpDoubArr[0], tmpDoubArr[1], 0.00);
        updateGPStext.text = "ENU: X: " + enu[0] + ", Y: " + enu[1];

        // Set Position of Player Instance
        // Alternate: rigi.position for non-interpolatet movement between positions
        Vector3 movement = new Vector3((float)tmpDoubArr[0], 0, (float)tmpDoubArr[1]);

        rigi.MovePosition(transform.position + movement);
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        // get reference to player Instance for transformations
        rigi = GetComponent <Rigidbody>();

        // Initialize with Startpoint
        coordUtil = new CoordinateUtilities(tmplat, tmplon, 0.00);

        // Testing if it works
        double[] enu2 = coordUtil.geo_to_enu(tmplat, tmplon, 0.00);
        Debug.Log("ENU: X: " + enu2[0] + ", Y: " + enu2[1]);

        // Call for Location Permission
        if (!Permission.HasUserAuthorizedPermission("android.permission.ACCESS_FINE_LOCATION"))
        {
            Permission.RequestUserPermission("android.permission.ACCESS_FINE_LOCATION");
            Permission.RequestUserPermission("android.permission.ACCESS_COARSE_LOCATION");
            Permission.RequestUserPermission("android.permission.TYPE_ORIENTATION");
        }

        // initialize lerping
        lastTime = Time.time;
        int   index   = 0;
        float strecke = 0;
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        double lat = 49;
        double lon = 11;
        double alt = 0;

        CoordinateUtilities kompass_test = new CoordinateUtilities(lat, lon, alt);

        double[] enu = kompass_test.geo_to_enu(lat, lon, alt);
        print("enu = " + enu[0] + "," + enu[1]);
    }