public void TogglePlanes(Boolean value) { ARController controller = GameObject.FindObjectOfType <ARController>(); controller.planes.ForEach(p => p.SetActive(value)); PointcloudVisualizer pointCloud = GameObject.FindObjectOfType <PointcloudVisualizer>(); pointCloud.gameObject.SetActive(value); controller.PlanesSearch = value; }
private void _selectPlane(Touch touch) { // RayCast against the location the player touched to search for planes. TrackableHit hit; TrackableHitFlags raycastFilter = TrackableHitFlags.PlaneWithinPolygon | TrackableHitFlags.FeaturePointWithSurfaceNormal; if (Frame.Raycast(touch.position.x, touch.position.y, raycastFilter, out hit)) { if (Vector3.Dot(FirstPersonCamera.transform.position - hit.Pose.position, hit.Pose.rotation * Vector3.up) < 0) { Debug.LogError("back rayCast"); return; } // Use hit pose and camera pose to check if hitTest is from the // back of the plane, if it is, no need to create the anchor. if ((hit.Trackable is DetectedPlane) && _currentPlane == null) { _currentPlane = (DetectedPlane)hit.Trackable; _aimAnchor = Session.CreateAnchor(hit.Pose); if (_referencePlan == null) { // Instantiate Plan model at the hit pose. _referencePlan = Instantiate(ReferencePlanPrefab, _aimAnchor.transform.position, _aimAnchor.transform.rotation); // Make Plan model a child of the anchor. _referencePlan.transform.parent = _aimAnchor.transform; } // Remove Point Cloud (blue dots int he Finding Mode if (_pointCloud != null) { PointcloudVisualizer p = _pointCloud.GetComponent <PointcloudVisualizer>(); p.IsAllow = false; } var session = GameObject.Find("ARCore Device") .GetComponent <ARCoreSession>(); session.SessionConfig.PlaneFindingMode = DetectedPlaneFindingMode.Disabled; // session.OnEnable(); } } }
// void OnGUI () { // if (GUI.Button (new Rect (25, 25, 300, 100), "Button")) { // // This code is executed when the Button is clicked // } // } public void OnClickButtonDelete() { // Destroy the Aim if (_aim != null) { Destroy(_aim); _aim = null; } // destroy the Aim's Anchor if (_aimAnchor != null) { Destroy(_aimAnchor); _aimAnchor = null; } // destroy the Reference Plan if (_referencePlan != null) { Destroy(_referencePlan); _referencePlan = null; } // remove a link to Transform _aimTransform = null; // destroy the Current Plan _currentPlane = null; // Start showing blue dots if (_pointCloud != null) { PointcloudVisualizer p = _pointCloud.GetComponent <PointcloudVisualizer>(); p.IsAllow = true; } var session = GameObject.Find("ARCore Device") .GetComponent <ARCoreSession>(); session.SessionConfig.PlaneFindingMode = DetectedPlaneFindingMode.HorizontalAndVertical; session.OnEnable(); }
// Use this for initialization void Start() { pointCloudVisualizer = pointCloud.GetComponent <PointcloudVisualizer>(); previousPosition = Vector3.zero; }
public override void OnInspectorGUI() { m_Target = (PointcloudVisualizer)target; DrawDefaultInspector(); DrawDivisionsInspector(); }