示例#1
0
    public AnchorPosition UpdateNewAnchorPositionInformation()
    {
        // get the information from the createAnchorPanel
        // update information of the currentSpatialAnchor
        var newSpatialAnchor = new SpatialAnchor(anchorNameInputField.text);

        newSpatialAnchor.Type               = anchorTypeRadialSet.ToggleList[anchorTypeRadialSet.CurrentIndex].name;
        newSpatialAnchor.AnchorPosition     = currentAnchorPosition.transform.position.ToString();
        newSpatialAnchor.WorldToLocalMatrix = currentAnchorPosition.transform.worldToLocalMatrix.ToString();

        // if there is previousSpatial anchor
        if (previousAnchorPosition != null)
        {
            // update information of the edge
            currentEdge.ConnectedName = anchorNameInputField.text;
            currentEdge.Distance      = Vector3.Distance(currentAnchorPosition.transform.position, previousAnchorPosition.transform.position);
        }

        // initialize anchorPosition
        currentAnchorPosition.Init(newSpatialAnchor);

        // disable tap to place of the currentAnchorPosition
        currentAnchorPosition.GetComponent <TapToPlace>().enabled = false;

        // reset anchorNameInputFile TEXT
        anchorNameInputField.text = "";

        return(currentAnchorPosition);
    }
示例#2
0
    private void HandleAnchorFound(string anchorId, AnchorPosition anchorPos)
    {
        anchorPos.Init(spatialAnchorsInQuery[anchorId]);
        anchorPos.AnchorConfirmed();
        if (!SceneAnchorPositions.Contains(anchorPos))
        {
            SceneAnchorPositions.Add(anchorPos);
            Debug.Log($"Add anchor position of '{anchorId}' to the scene");
        }
        else
        {
            Destroy(anchorPos);
        }

        currentAnchorPosition = anchorPos;


        Debug.Log($"Anchor '{spatialAnchorsInQuery[anchorId].Name}' have been found, removing from the query list ");
        spatialAnchorsInQuery.Remove(anchorId);


        if (spatialAnchorsInQuery.Count > 0)
        {
            Debug.Log($"continue finding '{spatialAnchorsInQuery.Count}' more spatial anchors... ... ...");
        }
        else
        {
            Debug.Log("successully found all spatial anchors queried");
            if (inNavigationMode)
            {
                StartCoroutine(GenerateTransitionLines());
                dialogController.OpenDialog("Ready to start the navigation", "Now we have successfully located both your selected origin and destination and are ready to start navigating. Do you want to start the navigation now?", "navigate");
                progressIndicatorRotatingOrbsGo.SetActive(false);
                CloseProgressIndicator(progressIndicatorRotatingOrbs);
                //ToggleIndicator(progressIndicatorRotatingOrbs);
            }
            else
            {
                // show indicator
                indicator.GetComponent <PositionIndicator>().SetTarget(currentAnchorPosition.transform);
                indicator.SetActive(true);
                // show dialog confirm whether wanting to create a new anchor
                dialogController.OpenDialog("Creating a new spatial anchor", "Do you want to create a new spatial anchor?", "create");
            }
            CanStopWatcher?.Invoke();
        }
    }
示例#3
0
    public AnchorPosition UpdateNewAnchorPositionInformation()
    {
        // get the information from the createAnchorPanel
        // update information of the currentSpatialAnchor
        var newSpatialAnchor = new SpatialAnchor(anchorNameInputField.text);

        newSpatialAnchor.Type               = anchorTypeRadialSet.ToggleList[anchorTypeRadialSet.CurrentIndex].name;
        newSpatialAnchor.AnchorPosition     = currentAnchorPosition.transform.position.ToString();
        newSpatialAnchor.WorldToLocalMatrix = currentAnchorPosition.transform.worldToLocalMatrix.ToString();

        string connectAnchorName = connectAnchorDropdown.options[connectAnchorDropdown.value].text;

        if (connectAnchorName != null)
        {
            var connectAnchor = GetAnchorPosition(connectAnchorName);
            Debug.Log($"Connect to {connectAnchor.SpatialAnchorObject.Name}");
            currentEdge.Name            = connectAnchorName;
            currentEdge.SpatialAnchorId = connectAnchor.SpatialAnchorObject.SpatialAnchorId;
            previousAnchorPosition      = connectAnchor;
        }

        if (previousAnchorPosition != null)
        {
            // update information of the edge
            currentEdge.ConnectedName = anchorNameInputField.text;
            currentEdge.Distance      = Vector3.Distance(currentAnchorPosition.transform.position, previousAnchorPosition.transform.position);
        }

        // initialize anchorPosition
        currentAnchorPosition.Init(newSpatialAnchor);

        // disable tap to place of the currentAnchorPosition
        currentAnchorPosition.GetComponent <TapToPlace>().enabled = false;

        // reset anchorNameInputFile TEXT
        anchorNameInputField.text = "";

        return(currentAnchorPosition);
    }