Пример #1
0
    IEnumerator Start()
    {
        arPlaneAnchorManager = new ARPlaneAnchorManager();

        // showing of the scene
        shadow.gameObject.SetActive(true);
        logo.SetActive(true);
        yield return(new WaitForSecondsRealtime(2.0f));

        logo.SetActive(false);
        yield return(StartCoroutine(shadow.FadeOut()));

        //find ground surface
        findPlane.SetActive(true);
        yield return(new WaitForSecondsRealtime(2.0f));

        while (arPlaneAnchorManager.GetCurrentPlaneAnchors().Count == 0)
        {
            yield return(new WaitForSecondsRealtime(1.0f));
        }

        findPlane.SetActive(false);
        arCameraManager.RunSession(false, false);

        Vector3 pos = -1 * UserData.Instance.LandInfo.OffsetFromCenter;

        pos  -= UnityARMatrixOps.GetPosition(arCameraManager.Session.GetCameraPose());
        pos.y = UnityARMatrixOps.GetPosition(arPlaneAnchorManager.GetCurrentPlaneAnchors() [0].transform).y;

        GameObject prefab = sceneRootPrefab;

        foreach (LandScene ls in landScenes)
        {
            if (ls.id == UserData.Instance.LandInfo.LandId)
            {
                prefab = ls.scene;
            }
        }

        objects.Add(Instantiate(prefab, pos, Quaternion.identity));

//		Vector3 pos01 = Vector3.zero;
//		pos01.y = UnityARMatrixOps.GetPosition (arPlaneAnchorManager.GetCurrentPlaneAnchors () [0].transform).y;
//		objects.Add (Instantiate (sceneRootPrefab, pos01, Quaternion.identity));
    }