Exemplo n.º 1
0
    public void OnInputClicked(InputClickedEventData eventData)
    {
        //Load the next scene
        persistentGameObjectScript pgo = persistentGO.GetComponent <persistentGameObjectScript>();

        pgo.loadWorldAnchors = false;
        SceneManager.LoadSceneAsync("Ventana", LoadSceneMode.Single);
    }
Exemplo n.º 2
0
    private void OnWorldAnchorStoreLoaded(WorldAnchorStore store)
    {
        var persistentGameObject = GameObject.Find("persistentGameObject");
        persistentGameObjectScript persistentScript = persistentGameObject.GetComponent <persistentGameObjectScript>();

        if (persistentScript.loadWorldAnchors)
        {
            Debug.Log("LOADING WORLD ANCHORS");
            var ids = store.GetAllIds();

            foreach (var id in ids)
            {
                char[]   delimiterChars = { ':' };
                string[] anchorInfo     = id.ToString().Split(delimiterChars);
                Debug.Log("<color=yellow>Anchor ID:" + anchorInfo[0] + " Lossy Scale: " + anchorInfo[1] + " Creation Time: " + anchorInfo[2]);

                ModelController mc        = ModelController.Instance;
                int             integerID = Convert.ToInt32(anchorInfo[0]);
                try
                {
                    GameObject            go  = mc.GetPrefabWithId(integerID);
                    BaseVentanaController bvc = go.GetComponent <BaseVentanaController>();
                    if (bvc)
                    {
                        bvc.OnVumarkFound();
                        bvc.VentanaID = integerID;
                    }
                    HandDraggable hd = go.AddComponent <HandDraggable>();
                    hd.enabled           = false;
                    hd.RotationMode      = HandDraggable.RotationModeEnum.OrientTowardUserAndKeepUpright;
                    hd.IsDraggingEnabled = true;

                    float scaleVal = float.Parse(anchorInfo[1], CultureInfo.InvariantCulture.NumberFormat);

                    go.transform.localScale = new Vector3(scaleVal, scaleVal, scaleVal);
                    store.Load(id, go);
                }
                catch (Exception ex)
                {
                    Debug.Log("[Anchor Loader] " + ex.Message);
                }
            }
        }
        else
        {
            store.Clear();
            Debug.Log("World Anchor Store CLEARED");
        }
    }