public void LoadPlaneList(JToken mapMetadata)
        {
            //placenoteARAnchorManager = new PlacenoteARAnchorManager ();
            foreach (var planeGo in loadedPlaneList)
            {
                GameObject.Destroy(planeGo);
            }
            loadedPlaneList.Clear();

            if (mapMetadata is JObject && mapMetadata ["planes"] is JObject)
            {
                PlaneMeshList planeList = mapMetadata ["planes"].ToObject <PlaneMeshList> ();
                if (planeList == null)
                {
                    Debug.Log("Empty list of planes in metadata");
                    return;
                }
                Debug.Log("Loading + " + planeList.meshList.Length.ToString() + " planes");
                foreach (var plane in planeList.meshList)
                {
                    GameObject go = PlacenotePlaneUtility.CreatePlaneInScene(plane);
                    go.AddComponent <DontDestroyOnLoad> ();                     //this is so these GOs persist across scene loads
                    loadedPlaneList.AddLast(go);
                }
                placenoteARAnchorManager.Destroy();                  //stop detecting new planes
            }
            else
            {
                Debug.Log("No plane metadata available");
                return;
            }
        }
Example #2
0
		public void UpdateAnchor(ARPlaneAnchor arPlaneAnchor)
		{
			if (planeAnchorMap.ContainsKey (arPlaneAnchor.identifier)) {
				ARPlaneAnchorGameObject arpag = planeAnchorMap [arPlaneAnchor.identifier];
				PlacenotePlaneUtility.UpdatePlaneWithAnchorTransform (arpag.gameObject, arPlaneAnchor);
				arpag.planeAnchor = arPlaneAnchor;
				planeAnchorMap [arPlaneAnchor.identifier] = arpag;
			}
		}
Example #3
0
		public void AddAnchor(ARPlaneAnchor arPlaneAnchor)
		{
			GameObject go = PlacenotePlaneUtility.CreatePlaneInScene (arPlaneAnchor);
			go.AddComponent<DontDestroyOnLoad> ();  //this is so these GOs persist across scene loads
			ARPlaneAnchorGameObject arpag = new ARPlaneAnchorGameObject ();
			arpag.planeAnchor = arPlaneAnchor;
			arpag.gameObject = go;
			planeAnchorMap.Add (arPlaneAnchor.identifier, arpag);
		}
Example #4
0
        // Use this for initialization
        public void StartPlaneDetection()
        {
            if (UnityARSessionNativeInterface.IsARKit_1_5_Supported())
            {
                PlacenotePlaneUtility.InitializePlanePrefab(meshPrefab);
            }
            else
            {
                PlacenotePlaneUtility.InitializePlanePrefab(planePrefab);
            }

            placenoteARAnchorManager = new PlacenoteARAnchorManager();
        }
        // Use this for initialization
        void Start()
        {
            placenoteARAnchorManager = new PlacenoteARAnchorManager();
            loadedPlaneList          = new LinkedList <GameObject> ();

            if (UnityARSessionNativeInterface.IsARKit_1_5_Supported())
            {
                PlacenotePlaneUtility.InitializePlanePrefab(meshPrefab);
            }
            else
            {
                PlacenotePlaneUtility.InitializePlanePrefab(planePrefab);
            }
        }