public void onClickPlaceGameObject() { var planes = GameObject.FindGameObjectsWithTag("planeTag"); var particles = GameObject.FindGameObjectsWithTag("particleTag"); foreach (var plane in planes) { Destroy(plane); } foreach (var particle in particles) { Destroy(particle); } ARPointCloudVisualizer = GameObject.Find("AR Root").GetComponent <ARPointCloudVisualizer> (); ARPlaneVisualizer = GameObject.Find("AR Root").GetComponent <ARPlaneVisualizer> (); Destroy(ARPointCloudVisualizer); Destroy(ARPlaneVisualizer); Destroy(GameObject.Find("FocusSquare")); PlaceGameObjectBtn.gameObject.SetActive(false); playmode.gameObject.SetActive(true); GameObject.Find("Canvas").GetComponent <PortionControl>().Small(); // placecar 이후 최소 사이즈로 시작 }
public void onClickPlaceGameObject() { var planes = GameObject.FindGameObjectsWithTag("planeTag"); var particles = GameObject.FindGameObjectsWithTag("particleTag"); foreach (var plane in planes) { Destroy(plane); } foreach (var particle in particles) { Destroy(particle); } ARPointCloudVisualizer = GameObject.Find("AR Root").GetComponent <ARPointCloudVisualizer> (); ARPlaneVisualizer = GameObject.Find("AR Root").GetComponent <ARPlaneVisualizer> (); Destroy(ARPointCloudVisualizer); Destroy(ARPlaneVisualizer); Destroy(GameObject.Find("FocusSquare")); PlaceGameObjectBtn.gameObject.SetActive(false); colorsPanel.gameObject.SetActive(true); lightsPanel.gameObject.SetActive(true); }
void Start() { ARPlaneHandler.returnARPlane += PlaceMap; ARPlaneHandler.resetARPlane += ResetPlane; _pointScript = _arRoot.GetComponent(typeof(ARPointCloudVisualizer)) as ARPointCloudVisualizer; _planeScript = _arRoot.GetComponent(typeof(ARPlaneVisualizer)) as ARPlaneVisualizer; }
// Update is called once per frame private void Update() { if (Input.GetMouseButtonDown(0)) { var camera = GetCamera(); Ray ray = camera.ScreenPointToRay(Input.mousePosition); int layerMask = 1 << LayerMask.NameToLayer("ARGameObject"); // Planes are in layer ARGameObject RaycastHit rayHit; if (Physics.Raycast(ray, out rayHit, float.MaxValue, layerMask)) { Transform planeTransform = rayHit.collider.transform.parent; onPlaneSelected.Invoke(planeTransform); if (disableThisAfterSelect) { this.enabled = false; } if (disablePlanesAfterSelect) { // Stop adding/removing/updating planes position ARPlaneVisualizer arPlaneVis = GetComponent<ARPlaneVisualizer>(); if (arPlaneVis != null) { arPlaneVis.enabled = false; } } if (hidePointCloudAfterSelect) { // Hide point cloud ARPointCloudVisualizer arPointCloudVis = GetComponent<ARPointCloudVisualizer>(); if (arPointCloudVis != null) { arPointCloudVis.enabled = false; } } } } }
void Start() { arPoints = arRoot.GetComponent <ARPointCloudVisualizer>(); arPlanes = arRoot.GetComponent <ARPlaneVisualizer>(); SetAnchorMode(true); }