public async override Task EnumerateAllNearbyAnchorsAsync()
        {
            Debug.Log("Enumerating near-device spatial anchors in the cloud");

            NearDeviceCriteria criteria = new NearDeviceCriteria();

            criteria.DistanceInMeters = 5;
            criteria.MaxResultCount   = 20;

            var cloudAnchorSession = CloudManager.Session;

            var spatialAnchorIds = await cloudAnchorSession.GetNearbyAnchorIdsAsync(criteria);

            Debug.LogFormat("Got ids for {0} anchors", spatialAnchorIds.Count);

            List <CloudSpatialAnchor> spatialAnchors = new List <CloudSpatialAnchor>();

            foreach (string anchorId in spatialAnchorIds)
            {
                var anchor = await cloudAnchorSession.GetAnchorPropertiesAsync(anchorId);

                Debug.LogFormat("Received information about spatial anchor {0}", anchor.Identifier);
                spatialAnchors.Add(anchor);
            }

            feedbackBox.text = $"Found {spatialAnchors.Count} anchors nearby";
        }
Exemplo n.º 2
0
        protected void SetNearDevice(float DistanceInMeters, int MaxAnchorsToFind)
        {
            NearDeviceCriteria nearDeviceCriteria = new NearDeviceCriteria();

            nearDeviceCriteria.DistanceInMeters = DistanceInMeters;
            nearDeviceCriteria.MaxResultCount   = MaxAnchorsToFind;

            anchorLocateCriteria.NearDevice = nearDeviceCriteria;
        }
Exemplo n.º 3
0
    private void SetNearDevice()
    {
        NearDeviceCriteria nearDeviceCriteria = new NearDeviceCriteria();

        nearDeviceCriteria.DistanceInMeters = coarseRelocalizationSettings.DistanceInMeters;
        nearDeviceCriteria.MaxResultCount   = coarseRelocalizationSettings.MaxResultCount;

        anchorLocateCriteria.NearDevice = nearDeviceCriteria;
    }
Exemplo n.º 4
0
    //method to find anchors based on geolocation + wifi
    public void findAnchorsByLocation()
    {
        //set a neardevicecriteria to look for anchors within 5 meters
        //can return max of 25 anchors to be searching for at once time here
        NearDeviceCriteria nearDeviceCriteria = new NearDeviceCriteria();

        nearDeviceCriteria.DistanceInMeters = 5;
        nearDeviceCriteria.MaxResultCount   = 25;
        AnchorLocateCriteria anchorLocateCriteria = new AnchorLocateCriteria();

        anchorLocateCriteria.NearDevice = nearDeviceCriteria;
        debugText.text = "Trying to find anchors by location";
        spatialAnchorManager.Session.CreateWatcher(anchorLocateCriteria);
    }
Exemplo n.º 5
0
    //method to find anchors based on geolocation + wifi
    public async void FindAnchorsByLocation()
    {
        Log.debug("Getting ActiveWatchers");

        if (anchorFirstTimeFound)
        {
            await ResetSession();
        }
        Log.debug("Finding Anchors By Location");
        //set a neardevicecriteria to look for anchors within 5 meters
        //can return max of 25 anchors to be searching for at once time here
        NearDeviceCriteria nearDeviceCriteria = new NearDeviceCriteria();

        nearDeviceCriteria.DistanceInMeters = 25;
        nearDeviceCriteria.MaxResultCount   = 35;
        AnchorLocateCriteria anchorLocateCriteria = new AnchorLocateCriteria();

        anchorLocateCriteria.NearDevice = nearDeviceCriteria;
        Debug.Log($"Creating Watcher ");
        spatialAnchorManager.Session.CreateWatcher(anchorLocateCriteria);
        Debug.Log("Watcher is created");
        anchorFirstTimeFound = true;
    }