Exemple #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);
    }
Exemple #2
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);
    }