public void PlaneToggle() { planesAreVisible = !planesAreVisible; //disables/enables prefabs for planes found in future arPlaneManager.planePrefab.SetActive(planesAreVisible); //disables/enables renderering existing planes foreach (GameObject plane in GameObject.FindGameObjectsWithTag("AR Plane")) { Renderer r = plane.GetComponent <Renderer>(); ARPlaneMeshVisualizer t = plane.GetComponent <ARPlaneMeshVisualizer>(); r.enabled = planesAreVisible; t.enabled = planesAreVisible; } //disables/enables prefabs for points found in future arPointCloudManager.pointCloudPrefab.SetActive(planesAreVisible); //disables/enables renderering existing points foreach (GameObject point in GameObject.FindGameObjectsWithTag("AR Points")) { Renderer r = point.GetComponent <Renderer>(); ARPointCloudParticleVisualizer t = point.GetComponent <ARPointCloudParticleVisualizer>(); r.enabled = planesAreVisible; t.enabled = planesAreVisible; } }
// Start is called before the first frame update void Start() { arSessionOrigin = FindObjectOfType <ARSessionOrigin>(); arPointCloudManager = FindObjectOfType <ARPointCloudManager>(); arPointCloudManager.pointCloudsChanged += UpdatedCloudPoints; arVisualizer = GetComponent <ARPointCloudParticleVisualizer>(); }
// Update is called once per frame void Update() { if (placementFinished && arPointCloud == null) { arPointCloud = arSessionOrigin.trackablesParent.GetComponentInChildren <ARPointCloud>(); } if (arVisualizer == null) { arVisualizer = arSessionOrigin.trackablesParent.GetComponentInChildren <ARPointCloudParticleVisualizer>(); } }