Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;

        // Find the LocationProvider
        locationProvider = ARLocationProvider.Instance;
        if (locationProvider == null)
        {
            Debug.LogError("[ARFoundation+GPSLocation][ARLocatedObjectsManager]: LocationProvider GameObject or Component not found.");
            return;
        }

        // Add the initially set objects
        foreach (var entry in objects)
        {
            Add(entry);
        }

        // Register callback for handling location updates
        locationProvider.OnLocationUpdated(HandleLocationUpdatedDelegate);

        // Register callback for handling new camera frames
#if !ARGPS_USE_VUFORIA
        ARSubsystemManager.cameraFrameReceived += frameHandler;
#endif
        // Cart onStart delegates
        hasStarted = true;
        if (onStartDelegate != null)
        {
            onStartDelegate();
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        if (locationPath == null)
        {
            throw new Exception("null location path");
        }

        pointCount = locationPath.locations.Length;
        points     = new Vector3[pointCount];

        locationProvider = ARLocationProvider.Instance;
        locationProvider.OnLocationUpdated(LocationUpdated);

        manager = ARLocationManager.Instance;
        manager.OnRestart(OnRestartHandler);

        arLocationRoot = Utils.FindAndLogError("ARLocationRoot", "[ARLocationMoveAlongPath]: ARLocationRoot GameObject not found.");

        // Check if we use smooth movement
        if (movementSmoothingFactor > 0)
        {
            gameObject.AddComponent <SmoothMove>();
            GetComponent <SmoothMove>().smoothing = movementSmoothingFactor;
        }

        transform.SetParent(arLocationRoot.transform);

        playing = autoPlay;

        if (showDebugInfo)
        {
            arLocationDebugInfo = Utils.FindAndGetComponent <ARLocationDebugInfo>("ARLocationRoot");

            if (arLocationDebugInfo == null)
            {
                showDebugInfo = false;
            }
            else if (lineRenderer != null)
            {
                SetupDebugObjects();
            }
        }
    }
Ejemplo n.º 3
0
    //public void RecvLocation(string RecLoc)
    //{
    //    RecLocation1 = RecLoc;
    //}

    // Use this for initialization
    private void Start()
    {
        //if (locationPath == null)
        //{
        //    throw new System.Exception("null location path");
        //}

        string RecLocation = PlayerPrefs.GetString("LocationPath");

        string word = "|";

        string[] words = RecLocation.Split(new string[] { word }, StringSplitOptions.None);
        int      cnt   = words.Length;

        pointCount = cnt;
        points     = new Vector3[pointCount];

        locationProvider = ARLocationProvider.Instance;
        locationProvider.OnLocationUpdated(LocationUpdated);

        manager = ARLocationManager.Instance;
        manager.OnRestart(OnRestartHandler);

        arLocationRoot = Utils.FindAndLogError("ARLocationRoot", "[ARLocationMoveAlongPath]: ARLocationRoot GameObject not found.");

        transform.SetParent(arLocationRoot.transform);

        if (showDebugInfo)
        {
            arLocationDebugInfo = Utils.FindAndGetComponent <ARLocationDebugInfo>("ARLocationRoot");

            if (arLocationDebugInfo == null)
            {
                showDebugInfo = false;
            }
            else
            {
                SetupDebugObjects();
            }
        }
    }